Installing multiple Xcode versionsSep 7, 2010 · 3 minute read · Comments
As a follow up to the posts on the release of iOS 4.02 and the imminent release of 4.1 I thought I would cover in more detail how to install multiple versions of Xcode on the same mac. I have previously mentioned some general guidelines when juggling iOS versions but there are some specific considerations to take into account when installing multiple versions of Xcode.
Installing Xcode in a custom directory
As a basic guideline you want to keep your production version of Xcode installed in the default location under /Developer. The production version would usually be the last version released and supported by Apple (not a beta or preview release). This is the version you should use for building and submitting applications to the App Store.
When Apple releases a beta version of iOS for developers it is usually bundled with a new version of Xcode. To develop and test applications with these pre-production versions you need to install these additional versions to a custom directory.
The option to install to a custom directory is easy to miss during the installation. After selecting the disk that you want to install on you have the option to select the installation location. The example below shows the default value of Developer.
To change the installation directory click on the Developer folder under the location column, select other and then navigate to the directory where you want to install this version of Xcode. I tend to install in a directory with the xcode or ios version number. So for a beta version of Xcode 3.2.4 I would install in /xcode324. Then when the final production version is released I will upgrade the version I have installed in /Developer and delete the /xcode324 directory.
Non Relocatable Components
Installing multiple versions of Xcode is pretty straightforward but there are some limitations. There are two components which are not relocatable - the System Tools and the Unix Development packages. This means that no matter how many versions of Xcode you have installed on a mac you can only have one version of these components and they will always be installed under /Developer on the OSX boot volume.
The system tools include things such as Shark. The Unix development package includes command line utilities, header files, libraries and an additional copy of the GCC compiler. These utilities are deliberately installed in a fixed location so that build scripts or other command line utilities you might be using can always rely on the location
When you install a second version of Xcode you need to decide if you want to overwrite the production versions of these packages that are installed in /Developer or skip them. Generally when installing beta versions you can install these additional packages without too much concern. The newer versions of the system tools will usually still work fine with earlier versions of Xcode - checking the release notes for additional details is always a good idea before installing.
I am more cautious when installing the more experimental alpha or preview versions of software. In those cases I will install Xcode in its own directory and skip the installation of the system tools and Unix development packages. This may mean you do not get access to all the new features but it avoids impacting the production version. In situations where you really want to install the complete package without overwriting the existing production versions you can always boot from a separate disk and install to /Developer on that disk. Then when you are done you reboot from your original OSX drive.