We use Xcode to develop for Apple platforms and there are many versions (includes beta versions) of Xcode to choice for different purposes. So we need to manage the versions of Xcode and it’s not that easy.
Let’s take about how Xcode::Install can help us to manage the versions of Xcode.
The Ways Without Xcode::Install
It may be the most common place to download Xcode, but we cannot keep more than one version. So we have to turn off Automatic Updates for App Store to “manage” the version.
We can download the version we want from it and there is no need to turn off Automatic Updates for App Store. However, if we want to keep more than one version of Xcode, we need to change to the name of Xcode according to its version like
The download may fail and need to retry from the beginning if we download by the browser, so we may rely on something like
wget --load-cookies to download and resume the download from the point it failed.
gem install xcode-install
Setup Apple ID
Add our Apple ID to our shell configuration file.
Then Xcode::Install will use this Apple ID when it needs without asking an Apple ID every time.
List of Available Xcode Versions
This list is cached. To update the list of available versions, run:
xcversion install "11.3.1"
This line will install Xcode to
/Applications/Xcode.app to it and do
We also can only do the installation with the option
Command Line Tools for Xcode
Install Command Line Tools for Xcode
Show the version of selected Command Line Tools for Xcode
Select the version of Command Line Tools for Xcode (
xcode-select --switch )
xcversion select 11.3
Select the version of Command Line Tools for Xcode and link the
xcversion select 11.3 —-symlink
I have encountered some issues when I have an Xcode installed from the App Store. I thought it may be caused by the symlink, so I try to install with
--no-switch, but it didn’t work.
If you are in the same situation, trying to remove the Xcode installed from the App Store may help.
What do you think?
Thanks to xcode-install, it’s easy to manage the versions of Xcode. And we may also use it in some scripts or CI since it’s a command-line tool.