Easy way to switch between Xcode versions

Tram Ho

This is a translation from medium.com . Please see the original post here: https://medium.com/better-programming/easily-swith-between-xcode-versions-b36f9f685979

How easy it is to switch between Xcode versions to check your code in the most comprehensive way.

iOS 14 has officially been released. If you need to install a new version of Xcode to test your apps, and you also need to keep the old version of Xcode for some reason, then this article is for you.

Every time there is a new version of iOS, we have to update the compiler to be able to test apps with the new operating system on the new iPhone.

I have worked on a few applications and always had a situation like this: A new version of iOS comes out and we have to update our Xcode , but our CI is configured with the version. Before that or maybe we have a library maintained by developers and they use the same old version of Xcode for consistency across applications.

The solution is always to manually download all the versions we need and then pray to a certain god that nothing breaks compatibility in the code. Is there an easier way?

The easiest and fastest way

There is a tool called xcode-install that allows you to easily install and manage multiple versions of Xcode on your computer. Certainly, you have heard of NVM (Node version manager) or RVM (Ruby version manager). This is something similar, but for Xcode.

Setting

Just run this command on your terminal :

Use

Now it’s time to use and start managing our Xcode versions. We can list all available and installed versions of Xcode with the following command:

Install a specific version of Xcode with the following command:

Choose a specific version of Xcode to use with the following command:

If you want to change the symlink at /Applications/Xcode , run the following:

And here is the command to see the currently selected version:

xcode-install needs the environment variables which are your credentials to access the Apple Developer Center . They are stored using the fastlane ‘s credentials_manager :

That’s it, now we can install or delete any version of xcode with a single command …

And what’s more with xcode-install

xcode-install can also install Xcode ‘s command line tools by calling the command:

xcode-install can also manage your emulators (iOS simulator) using the simulators command as follows:

I hope this tool can be useful to you. I call it my little XVM (Xcode version manager).

Share the news now

Source : Viblo