Skip to content

Instantly share code, notes, and snippets.

@brennanMKE
Created September 29, 2016 20:50
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save brennanMKE/e047a749212b1dda69338e29980c435a to your computer and use it in GitHub Desktop.
Save brennanMKE/e047a749212b1dda69338e29980c435a to your computer and use it in GitHub Desktop.
Installing and using multiple versions of Xcode

It is possible to have multiple versions of Xcode on your Mac. Where you may have trouble is getting your command-line to work well. Various develper tools are in the developer directory. When there are multiple versions of Xcode on a Mac one of them should be selected.

Print Path

Printing the path for the developer directory will show which copy of Xcode is currently selected.

 xcode-select -p

You can place Xcode anywhere. Generally the current version installed from the Mac App Store is in the Applications folder. If you are using a previous version or a new beta release you will want to place them in different folders. I suggest the following paths.

~/Xcode/7.3.1/
~/Xcode/8.1-beta/

These paths will make it clear which version of Xcode you have selected.

Selecting Xcode

Setting the path which will be used for your developer directory. It is done with the commands below. You will need admin privileges to run this command which done by using sudo.

sudo xcode-select -s ~/Xcode/7.3.1/Xcode.app
sudo xcode-select -s ~/Xcode/8.1-beta/Xcode.app
sudo xcode-select -s /Applications/Xcode.app

Using xcrun

The command below can be used to try out running one of the utilities located in the developer directory. One is simctl which is used to manage simulators.

xcrun simctl list devices

Listing Developer Tools

The following command will show a list of the tools in the developer directory. Notice git and many other command-line utilities are in this directory.

DEV_DIR=`xcode-select -p`; echo ${DEV_DIR}; ls ${DEV_DIR}/usr/bin

Caveat

When placing Xcode into a folder or renaming the Xcode.app application folder it is best to not use any spaces as some utilities or scripts may not handle the space well and could cause problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment