Installing multiple versions of Xcode (6, 7, 8) side-by-side, together on the same Mac

Let’s talk about cleanly installing multiple versions of Xcode (6, 7, 8) side-by-side, together on the same Mac desktop, MacBook Pro, or MacBook Air.

Apple keeps moving forward with new Xcode and iOS versions, but some of us in the developer community need the ability to support — or just experiment with — projects in older versions. I’m currently working on an iOS 9 app, developed in Xcode 7 that’s ready to be submitted to the App Store. At this eleventh hour, the last thing I want to do is go through the pain of upgrading to a new iOS SDK in a new Xcode version. I tried building the app and its constituent libraries in Xcode 8, and was presented with tens of compiler and linker errors. Oy… But I do need to to start moving the project to Xcode 8/iOS 10 — and start other projects, check out new features, and get up to speed…


If you update Xcode through the App Store app, you often run into problems, and the default installation process will trash your older Xcode versions. This article contains the steps I’ve used for successful side-by-side Xcode installations. Assume you’ve got Xcode 7.3 already installed, that this version is your current go-to development platform, but you want to also install Xcode 8.2.1 on the same Mac. (I’ll also show you that I still have Xcode 6.4 installed on the same Mac.) We’ll be taking advantage of the fact that MacOS apps are single self-contained bundles, and while Xcode does use some common files stored on your system, applications don’t have the kind of overly complicated structures as found in OS’s like Windows (ah, like the registry). Let’s get started…

1) Make sure Xcode is closed.

2) Go to your “/Applications” folder, create a new directory for your current Xcode installation, name it something like “Xcode73”, move “Xcode.app” into the new directory, and (temporarily) rename “Xcode.app” to “Xcode7.3.app”. If the old “Xcode.app” is not renamed, I’ve found that the installer for the new version of Xcode will step on the old version.

3) Download the installer for Xcode 8.2.1 from the Apple Developer site (“Downloads for Apple Developers” [https://developer.apple.com/download/more/]). Note that you’ll have to login with your Apple Developer credentials to reach this site. Do not use the App Store app to install (“Update”) Xcode 8.2.1.

4) To be safe, put the “Xcode 8.2.1.xip” installer on your desktop (i.e., somewhere other than your “/Applications” folder). Double-tap on the xip to start the installation process.

5) The newly installed Xcode 8.2.1 bundle “Xcode.app” will appear on your desktop. Drag it into the “/Applications” folder. You don’t have to put it there, but I like to keep things organized and consistent.

#ad

6) This is the moment of truth: starting Xcode 8.2.1 for the first time, but read the rest of the text in this step before proceeding. Once you decide on an option, double tap on “/Applications/Xcode.app”. If you chose to skip step 7, there’s no instant gratification; you’ll need to be patient as the new Xcode version starts (slowly). You’ll see these MacOS alerts whether you use step 7 or not:

The operating system is making sure you know that the app you just downloaded from the dreaded wild west Internet may contain malicious content (even though this is Apple software downloaded from the Apple Developer site). You may experience a long delay — with the spinning hallucinogenic wheel twirling — as MacOS runs a complex algorithm to inspect the Xcode.app bundle for nasty bits like viruses, worms… It can seem like your system has hung, but Apple is scrutinizing 4.2 GB of content. I would advise you to go make a cup of coffee, pick up and play your guitar, or read a copy of the Constitution, and just be patient until Xcode 8.2.1 opens up. Skip step 7 and, once Xcode comes up, go to step 8. If you’re the impatient type, go to step 7. If you follow step 7, you probably won’t have to wait too long before Xcode 8.2.1 opens.

7) For the impatient types, open up a Terminal window and enter the following commands:

You need to be an admin to run the “xattr” command, or you can use “sudo.” Thanks to Stack Overflow member John for explaining how the MacOS “Gatekeeper” works. You can read his post, but in a nutshell, “Running a command to get through Gatekeeper sounds like the way to go, since you downloaded it from a trusted source. Gatekeeper examines your entire bundle, making sure that there is no suspicious code. … Manually tell Gatekeeper ‘It’s okay, this is from a trusted source’.”


8) Xcode 8.2.1 starts opening up, but presents you with several alerts. Accept the Xcode license agreement and sign in with in your Mac’s admin password, and Xcode will start up!

9) Note: When creating your first Xcode 8.2.1 project and compiling it, you’ll probably have to set up code signing, provisioning, and assigning a development team. We’re kinda getting off-topic here, but in Xcode, go to your target and then settings for General -> Signing. It should be self-explanatory, but leave me a comment if you get stuck.

10) So what about having the ability to continue development using Xcode 7.3? Go to the “/Applications/Xcode73” directory and rename “Xcode7.3.app” back to “Xcode.app”. If you don’t, you’ll have problems — like errors telling you that Xcode can’t find the simulator. NOTE: Always close one version of Xcode before running another.

11) So what about having the ability to continue development using Xcode 6? Way back when I first installed Xcode 7, I faced the same dilemma, wanting to keep my ability to use Xcode 6 and 7 side-by-side. I followed the same process as described in this article. Right now, I can use Xcode 6, 7, and 8 all on the same Mac.

12) IMPORTANT: When opening Xcode projects, you want to make sure that you start the appropriate Xcode version in which the project was created. Yes, new Xcode versions will post a warning advising you to update your project settings to the newer version’s project settings protocol, but I’ve seen new versions of Xcode make changes to your project settings without even asking you.

#ad

When you want to open a project or workspace file — *.xcodeproj or *.xcworkspace — first right-click the file and look for the “Open With ->” context menu. Notice I can pick from Xcode 8.2.1, Xcode 7.3, or Xcode 6.4. If you want MacOS to remember which Xcode version in which to open a project or workspace file, hold down the “option” key while right-clicking and notice that the context menu changes to “Always Open With ->”.

Optionally, you can set your Mac’s default Xcode version using the following command (here, I’ll set it to Xcode 7 as I’m not yet ready to go all in with Xcode 8):

You can always quickly find out which Xcode version is the current default by inspecting the output (a path) from this command:

IMPORANT LAST NOTE 1: Installing Xcode 8 may change the version of “Command Line Tools” in your last Xcode version (for me, 7). I checked and adjusted this by opening my preferred Xcode version (7) and going to the menu Xcode -> Preferences -> Locations and resetting the “Command Line Tools” dropdown from “Xcode 8.2.1” to “Xcode 7.3”:

IMPORANT LAST NOTE 2: Before running any command line tools related to Xcode like:

… check the Xcode version and use “xcode-select” to set your default version so you don’t get errors, don’t build against the wrong SDK, don’t use a slightly different compiler, etc.

If you’re careful, you can configure your Mac to maintain side-by-side versions of Xcode. I wish you well with your development efforts. In the next article, we’ll talk about using an older version of Xcode with a new version of an iOS SDK.

#ad

Author: Andrew Jaffee

Avid and well-published author, software engineer, designer, and developer, now specializing in iOS mobile app development in Objective-C and Swift, but with a strong background in C#, C++, .NET, JavaScript, HTML, CSS, jQuery, SQL Server, MySQL, Oracle, Agile, Test Driven Development, Git, Continuous Integration, Responsive Web Design, blah, blah, blah ... Did I miss any fad-based catch phrases? My brain avatar was kindly provided by https://icons8.com under a Creative Commons Attribution-NoDerivs 3.0 Unported license.

3 thoughts on “Installing multiple versions of Xcode (6, 7, 8) side-by-side, together on the same Mac”

Leave a Reply to Curtis Cancel reply

Your email address will not be published. Required fields are marked *