Managing more than one installation of Xcode

If you have more than one version of Xcode installed, you may need to switch the folder location used by xcodebuild and related tools. For example, if you build projects outside Xcode via a shell script, switching from a developer preview to a supported release is a good idea.

xcode-select is a command line tool that manages the Xcode folder location for various build related tools.

Before installing Xcode 5 developer preview, here is how my system looks:

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

Once I installed Xcode 5, the output looks as follows:

$xcode-select --print-path
/Applications/Xcode5-DP.app/Contents/Developer

The parameter -switch instructs xcode-select to set the preferred Xcode path. Here is how I set the path to the stable release of Xcode on my system:

$ sudo xcode-select -switch /Applications/Xcode.app

View the documentation from a terminal using man xcode-select