API Development

Running Xcode 9 and Xcode 10 Side-by-side

 

💡See also an updated post for running Xcode 11 and Xcode 10 Side-by-side!

 


With the recent release of Xcode 10, it’s easy to get excited and upgrade (or have your Mac auto-upgrade for you) and end up in a situation where you can’t support some of your older apps.

It might be that you’re not ready to move to Titanium 7.4.0.GA yet, but still have to maintain a codebase and in these situations, updating to the latest major Xcode version can stop older apps working.

Luckily, there’s an easy way to have the both Xcode 9 and 10 running side-by-side on the same machine and build for both iOS 11.4 and 12 whenever you like.

Firstly, (and to show you what’s happening here) go to your Titanium application project folder in Terminal, and type appc run -p ios --ios-version 1 — you’re told (correctly) that “1” is invalid and asked to select an SDK version — if you have Xcode 9 installed, you’ll see 11.4 and with Xcode 10, you’ll see 12.

Let’s get another Xcode installed, and we’ll come back to this.

If your computer has already updated to Xcode 10, don’t worry — go to https://developer.apple.com, login and visit the download sections — you’ll need to go to the “more downloads”. And, within that, you’ll find the latest version of Xcode 9. Download that to your machine and extract it.

Next, rename the file to Xcode9 and move it into your Applications folder. You should now have two files — Xcode 10 and Xcode 9.

If you haven’t downloaded Xcode 10 yet, you can repeat the above steps and just download Xcode 10 instead. Then, rename the currently installed version to “Xcode9”, and move the Xcode 10 file to the Applications folder.

Either way, you should end up with a file called Xcode and another called Xcode9.

Next, make sure you launch whichever additional Xcode you downloaded, so it can install its additional components — this is important or you won’t be able to build with it.

Once you’re finished letting Xcode do it’s thing, go back to that Terminal window you had open earlier and run that same command again:

appc run -p ios --ios-version 1

You’ll notice you now have two options: 11.4 and 12. That’s because Titanium is detecting both Xcode installations and knows how to route the build to each based on the flag —ios-version. There’s no need to use xcode-select to change versions or do anything else.

So, if your application is in a previous version to 7.4.0.GA, all you have to do is specify the —ios-version 11.4 in the CLI and it’ll build with Xcode9. If your application uses 7.4.0.GA, then use —ios-version 12 and it’ll build with Xcode 10!

If you’re a Studio user, it’s just as easy — once you’ve installed Xcode 9 and 10 side-by-side and launched Studio, it’ll detect the changes — and you can simply select from the menu > iOS and the version you want to build with.

The end result is you can build new apps with the new Xcode and latest Titanium SDK whilst still supporting and maintaining old applications.

I hope this was useful to you — please leave a comment below and maybe tell us what you think of Xcode 10, are you already using both, and how are you finding updating your apps to the latest version of iOS and Titanium?

Happy Coding!