190

Is it possible to have more than one version of Xcode installed at the same time?

If so, please post any tip, tricks, or potential issues to watch out for.

EDIT:

The reason I want to install multiple versions is to try out the new sdk beta, but if the new Xcode is buggy I want to be able to use the older version for my existing projects.

JWWalker
  • 22,385
  • 6
  • 55
  • 76
TWA
  • 12,756
  • 13
  • 56
  • 92
  • 3
    After having installed both XCodes, you have a custom icon for XCode4 to easily differentiate them. Here is a custom icon - http://qdevarena.blogspot.com/2011/04/xcode-4-custom-icon.html – Rajavanya Subramaniyan Apr 12 '11 at 10:57
  • Here's an Icon I made quick for Xcode Beta 4.2...: ![enter image description here](http://i.stack.imgur.com/YOlKj.png) .png file--- .icns file--- Enjoy. – Hubert Kunnemeyer Aug 20 '11 at 02:05
  • link for all Xcode versions http://stackoverflow.com/questions/10335747/how-to-download-xcode-4-5-6-7-8-and-get-the-dmg-file – mfaani Sep 28 '16 at 18:17
  • See my answer for a much easier way to do what you ask for. Also, if you think this is a better way, consider marking my answer as the solution to your problem. I certainly think it's a far superior solution. – C. Sederqvist Dec 29 '19 at 06:45
  • @twa Have you considered marking my answer to your question as the "solution"? I believe few of the other answers are, and / or will stay viable for the time to come, given that most of the other answers here are now outdated and / or not working. – C. Sederqvist Jun 30 '21 at 18:57

13 Answers13

97

Yes, you can install multiple versions of Xcode. They will install into separate directories. I've found that the best practice is to install the version that came with your Mac first and then install downloaded versions, but it probably doesn't make a big difference. See http://developer.apple.com/documentation/Xcode/Conceptual/XcodeCoexistence/Contents/Resources/en.lproj/Details/Details.html this Apple Developer Connection page for lots of details. <- Page does not exist anymore!

Lin Du
  • 88,126
  • 95
  • 281
  • 483
MattK
  • 10,195
  • 1
  • 32
  • 41
  • 13
    To clarify, they will install into separate directories only if you explicitly specify it at install time. Also, you will generally want to unselect all features besides the xcode core tools, because the others don't let you change the install directory. – Paul Du Bois Jul 03 '11 at 03:30
  • 7
    Link is outdated. Can get old versions from [here](https://developer.apple.com/downloads/index.action), but there isn't any details on how to set them up or install them =(. – GeneralMike Sep 28 '12 at 15:10
  • 1
    I haven't had a chance to try this with a recent Xcode. I wonder if this changed with the addition of Xcode to the App Store? – MattK Oct 01 '12 at 19:52
  • 4
    This link can help you guys: http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html – King-Wizard Sep 10 '15 at 14:20
  • I recently upgraded to Xcode 7, and lost the ability to build and test on iOS 7.1. I downloaded Xcode 6.4 from https://developer.apple.com/downloads/index.action (as per previous comments) and copied Xcode.app to /Applications/Xcode-6.4, from which it runs very happily (as per information provided in http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html, again as per previous comments) – Martyn Davis Sep 23 '15 at 06:37
  • @King, Martyn, I just started to learn Apple development. If I use IDE for everything - code/build/test, do I still need to run the xcode-select cmd for switching between xcode6 and xcode7? I'm not sure if IDE will pick up right version of SDK/library automatically. Thanks. – shiouming Oct 13 '15 at 10:42
  • Link for all Xcode versions http://stackoverflow.com/questions/10335747/how-to-download-xcode-4-5-6-7-8-and-get-the-dmg-file – mfaani Sep 28 '16 at 18:16
  • Still don't get why my answer doesn't get up-voted. This is a solution made specifically to solve the concrete problem of the OP! https://stackoverflow.com/a/59517342/2557056 – C. Sederqvist Dec 29 '19 at 23:12
  • "the best practice is to install the version that came with your Mac ..." Since when did XCode come bundled with the Mac? A long time ago it was bundled with the OS installer DVDs, but that has nothing to do with your mac... Use my approach for an easy way. – C. Sederqvist Jan 13 '21 at 16:31
  • The URL in your post is actually still up, but it's now located at: https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/XcodeCoexistence/Contents/Resources/en.lproj/Details/Details.html – ReinstateMonica3167040 May 30 '21 at 14:57
45

Can I have multiple Xcode versions installed?

Solution:
Actually as many of the above answers says, it is possible. Even according to the following Oracle Mobile Platform Blog, you can install more than one XCodes in the same Mac. The reason why you need to do that may vary according to you.

Scenario:
You might have installed only one version of XCode for now. Mostly the one release behind the latest XCode version which is available through App Store (mine I've Xcode 6.3.2 and I needed to keep it and also install Xcode 7 which is available through App Store).

For Ex:-

You have already installed XCode 6.x, and App Store has XCode 7 already given by App Store. For any reason you need to keep that Older XCode 6.x(as you know it is stable for some time now) and also you need to install and try out new XCode 7

So number one question might be, How and Where could you download the Mac OS X installable DMG file for XCode 7 (or may be if you wanna try out an older XCode version)? Ok, here is the direct link apple downloads (you might have to log into Apple Developer account before viewing this link correctly), or else following is a StackOverflow Q&A link which gives the answer to where to download DMG files for XCode IDEs.

So now let's assume that you have obtained any of the DMG file for the XCode version you require to install as secondarily?

Steps:
Follow the steps given bellow which I got from the above given first link of Oracles Mobile Platform Blog.

  1. Close Xcode if running
  2. Rename /Applications/Xcode.app to /Applications/Xcode_6.x.app
  3. Enter the admin password when prompted
  4. Double click the DMG file of your required, pre-downloaded Xcode and install it
  5. Once installed it, before running it, change the new /Applications/Xcode.app that was just installed to (according to my above given example) /Application/Xcode_7.app

Note*:

[Please patiently read this section until the next Note] When you have two versions of Xcode installed, your workstation has two versions of Command Line Tool (xcodebuild) installed too. The question is what your Terminal and Xcode build command will use to when you are building your iOS App. Because along with the Command Line Tool, iOS SDK which is being used to build your app also depends on.

My experience was I've had two Xcode versions. Xcode 10 (Old one with iOS12.0 - iphoneos12.0), and Xcode 10.1 (New one with iOS 12.1 - iphoneos12.1). So obviously the settings for Command Line Tool was selected to use xcodebuild tool from the Old app. I had to manually select it in Xcode preference window.

Where to set Command Line Tool in Xcode Preference Window?

  • Select the Locations tab and there, you can select all the installed versions of Command Line Tools (which is xcodebuild).

How to figure out which version of iOS SDK is being used to build your iOS App?

  • On your Terminal issue following command: $> xcodebuild -showsdks
  • Above command should print out all the SDK details which your current Xcode configuration uses to build your Apps. And by seeing the results you will understand that your iOS/iphoneos SDK version depends on changing Command Line Tool (xcodebuild) setting on your Xcode.

Note**:
Above given Apple Downloads link and Oracles MPF blog post links might change and/or unavailable in the future.

So I hope that my this answer might be helpful to somebody else out there!
Cheers!

Community
  • 1
  • 1
Randika Vishman
  • 7,983
  • 3
  • 57
  • 80
43

It's easy to have multiple Xcode installs.

In the installer there's a pulldown for the location... you just need to pick a new location when you're installing the beta version.

These instructions from an Apple dev tools evangelist have the full details (Apple dev username/password required): https://devforums.apple.com/message/40847#40847

Then grab yourself a custom icon for the Beta version of XCode you're using, so you can tell them apart in the dock: http://iphonedevelopment.blogspot.com/2009/03/multiple-developer-tool-installs.html

shim
  • 9,289
  • 12
  • 69
  • 108
Jim Rhoades
  • 3,310
  • 3
  • 34
  • 50
39

You may want to use the "xcode-select" command in terminal to switch between the different Xcode version in the installed folders.

James Dale
  • 126
  • 1
  • 8
Eric Chan
  • 391
  • 3
  • 2
15

It seems that Xcode really likes to be in the Applications folder and be called Xcode, especially when using xcodebuild (when building for Carthage for example) - and xcode-select doesn't always seem to cut it.

I have a client project that's still using Swift 2.2, and I'm stuck on Xcode 7 for that and using Xcode 8 for anything else.

So, in my Applications folder, I have Xcode 7 (renamed to Xcode_7) and Xcode 8 (renamed to Xcode_8). Then I rename whichever one I need to simply Xcode, and back again when done. It's a ball-ache, but seems to work.

This shell script simplifies it a bit…

xcode-version.sh

cd /Applications

if  [[ $1 = "-8" ]]
then 
    if [ -e Xcode_8.app ] 
    then            
        mv Xcode.app Xcode_7.app
        mv Xcode_8.app Xcode.app
        echo "Switched to Xcode 8"
    else
        echo "Already using Xcode 8"
    fi
elif  [[ $1 = "-7" ]]
then
    if [ -e Xcode_7.app ] 
    then            
        mv Xcode.app Xcode_8.app
        mv Xcode_7.app Xcode.app
        echo "Switched to Xcode 7"
    else
        echo "Already using Xcode 7"
    fi
else
    echo "usage: xcode-version -7/8"
fi

xcode-select --switch Xcode.app
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160
  • 1
    Is running Xcode 8 and 7 in parallel causing any problems for you ? – nnrales Sep 30 '16 at 18:44
  • I haven't had any problems, as long as I remember to rename the appropriate version to Xcode.app each time. – Ashley Mills Sep 30 '16 at 19:56
  • Thanks for the solution and the handy script. By the way, I had to prepend `sudo` to the last line like so `sudo xcode-select --switch Xcode.app` to get the switching part working. – Isuru Oct 22 '16 at 07:22
  • 2
    Using `xcodebuild` from a specific Xcode version does not require a systemwide change of the default Xcode version. Setting the DEVELOPER_DIR environment variable before using `xcodebuild` is sufficient: `export DEVELOPER_DIR="/Applications/Xcode-9.3.app/Contents/Developer"`. – Rein Spijkerman May 10 '18 at 22:26
12

Note that if you use the xcodebuild command line tool, then the last version of Xcode installed will become the default version. (A symbolic link is installed in /usr/bin.) To use the xcodebuild for the other versions of Xcode you'll need to use the version in the (xcode_install_directory)/usr/bin directory.

note To switch between different versions of the Xcode command-line tools, use the xcode-select tool mentioned by other commenters.

ThomasW
  • 16,981
  • 4
  • 79
  • 106
10

Multiple Versions Of Xcode & Simulators using gem Xcode::Install

Install and update your Xcodes automatically.

You can greatly simplify this process by using the Xcode::Install Ruby Gem.

You should already have a working installation of the Xcode Command Line Tools and a version of Ruby that supports building native extensions.

I'd suggest using Homebrew for installing rbenv and use rbenv to install Ruby. A guide for this can be found here and many other places.

But it should work with the stock Ruby supplied by newer macOS versions as well, if you install the gem either using sudo (not recommended) or using --user-install when installing the gem.

Installation

Basically:

# Install the Ruby Gem (I'm using rbenv, so no sudo or --user-install)
$ gem install xcode-install

# To list available versions:
# PS!You will get prompted for your Apple Developer / iCloud credentials)
# It's using Apple's own API's so 2FA are supported if enabled

$ xcversion list
6.0.1
6.1
6.1.1
6.2 (installed)
6.3
# To update the list of available versions, run:
$ xcversion update

# To install a certain version, simply:
$ xcversion install 8

##################################################################### 100.0%
Please authenticate for Xcode installation...

Xcode 8
Build version 6D570

This should download and install and activate that version of Xcode. You can start it from /Applications as usual.

The new version will also be automatically selected for CLI commands To select a different version as active, you'll run:

xcversion select <version_number>

from the list of installed versions, marked as (installed) like:

# To see the active version in use:
$ xcversion selected

# To select and activate an installed version:
$ xcversion select 8

# To select, activate and change the symlink in /Apllications
$ xcversion select 8 --symlink

Other fun stuff, Simulators etc

Xcode::Install can also install Xcode's Command Line Tools by calling

xcversion install-cli-tools and can also manage your local simulators using the simulators command.

But instead of repeating more information that is probably going to change over time, head over to the project's GitHub page for more about this gem.

C. Sederqvist
  • 2,830
  • 19
  • 27
4

Staring with Xcode 9, the beta Xcode is labeled 'Xcode-beta.app' and is designed to live side by side with the production version. Info can be found in the Xcode release notes here. (Not using direct link because it breaks often).

From Apple:

Xcode 9 beta 4 can coexist with previous versions of Xcode. Prerelease versions of Xcode are made available from developer.apple.com, packaged in a compressed XIP file. To install Xcode during the beta period, download the XIP file, double-click the file to expand it in place, then drag Xcode-beta.app to the Applications folder

bauerMusic
  • 5,470
  • 5
  • 38
  • 53
  • A word of warning: All my Xcode 8 simulators are gone and I can't add new ones. It's all Xcode 9 from here on for me (or painfully removing everything Xcode 9 messed up during it's installation). YMMV. – Sebastian Sep 05 '17 at 14:23
  • @Sebastian I think mine are ok (using Xcode 8, but had 9 running before). I still have the option (Xcode > Window > Devices) to add other simulators. Might be worth opening a new topic if we can verify this. Can you add older simulators? – bauerMusic Sep 06 '17 at 13:57
  • another friend of mine confirmed that it's also working for him. So probably something is screwed up on my system. So I guess this is just a "things _might_ go wrong if you change anything" tale ;-) (and they will if you don't) – Sebastian Sep 06 '17 at 14:25
  • @Sebastian Can you re-add them from 'Devices'? – bauerMusic Sep 06 '17 at 15:26
  • Yesterday I could not ("[...] I can't add new ones"), the 'Create' button in the "Add Simulator" dialog did nothing. However I just re-opened my already abandoned Xcode 8 and there were all the simulators I tried to create yesterday, all working. I can also add new ones. @bauerMusic, thanks for pushing me to re-check. – Sebastian Sep 06 '17 at 15:49
  • @Sebastian Glad someone is walking the front line ;) I would like to believe it's a 'beta' thing. – bauerMusic Sep 06 '17 at 18:26
3

Download a version

The beta and stable releases can be taken from the Developer Software downloads Application tab, here), but older versions can be taken from here. Just extract the .xib and put Xcode-beta.app in your Applications folder.

Switch versions

  • Using the beta: sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
  • Using the original: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Check version changed

You can validate the version has changed by running xed --version, and it will output the correct version: e.g. xed version 12.5 or xed version 13.0

Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
  • This is the right solution. Simple, straight to the point, and requires no dependency or installation other than XCode. – RAM Dec 09 '21 at 18:08
  • I fear this is not entirely perfect. Xcode relies on dependencies to do it's work. Simply swapping out the `Xcode.app` in your `Applications` folder will do nothing to any files in the global `/Library/` where Xcode places those dependencies (`/Library/Developer/CommandLineTools` for example). It's entirely possible that installing new versions of Xcode can change those library dependencies in subtle & infuriating ways that may cause your builds to break. If you're looking for a foolproof way to `not break your existing builds`, I do not believe this is it. – BU0 Jul 20 '23 at 16:34
2

To have multiple Xcode instances installed you can put them to different folders for example /Developer5.0.2/Xcode, but to use them in CI or build environment(command line) you need to setup some environment variables during the build. You can have more instructions here. So it is working not just with beta and fresh release, also it's working for the really old versions, you might need it to use with Marmalade or Unity plugins which is not support the latest Xcode versions yet(some times it's happens).

0

Whatever advice path you go down, make a copy of your project folder, and rename the external most one to reflect what XCode version it is being opened in. Your choice on whether you want it to update syntax or not, but the main reason for all this bovver is your storyboard will be altered just by looking. It may be resolved by the time a new reader coming across this in the future, or

aremvee
  • 179
  • 1
  • 13
0

All the updates for new version of xcode will be available in appstore if you have installed the version from appstore. If you just paste the downloaded version appstore will show install not update. Hence keep the stable version downloaded from appstore in your applications folder.

To try new beta releases i usually put it in separate drive and unzip and install it there. This will avoid confusion while working on stable version.

To avoid confusion you can keep only the stable version in your dock and open the beta version from spotlight(Command + Space). This will place beta temporarily on dock. But it will make sure you don't accidentally edit your client project in beta version.

Most Important:- Working on same project on two different xcode might create some unwanted results. Like there was a bug in interface builder that got introduced in certain version of xcode. Which broke the constraints. It got fixed again in the next one.

Keep track of release notes to know exactly what are additional features and what are known issues.

Ashish P
  • 1,463
  • 1
  • 20
  • 29
-1
  1. First, remove the current Xcode installation from your machine. You can probably skip this step but I wanted to start fresh. Plus — Xcode was behaving a little weird lately so this is a good opportunity to do that.
  2. Install Xcode 8 from the App Store. Make sure project files (.xcodeproj) and workspace files (.xcworkspace) can be opened with the new Xcode installation (remember to select the Later option whenever prompted).
  3. Download the Xcode 7.3.1 dmg file from Apple. Double-tap the newly downloaded dmg file in order to get the standard “Drag to install Xcode in your Applications folder”. Don’t do that. Instead, drag the Xcode icon to the desktop. Change the file name to Xcode 7.3.1. Now drag it to the Applications folder.

Now you have two versions of Xcode installed on your machine. Xcode 7.3.1 and Xcode 8.

Details: Install Xcode 7 & Xcode 8 side by side

katwal-Dipak
  • 3,523
  • 2
  • 23
  • 23