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.
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.
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
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
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
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.