Use multiple versions of Xcode

Download xcode eBook

Example

You can have multiple versions of Xcode installed at the same time (including beta versions). Simply rename the application in Finder to avoid conflicts.

renaming Xcode in Finder

Note: Installing Xcode from the App Store will tend to overwrite an existing version on your machine. You can also install Xcode from a direct download to get more control over which versions you have.

Each copy of Xcode includes command line tools (clang, xcodebuild, etc.). You can choose which ones are invoked by the commands in /usr/bin.

In Xcode's preferences, under the Locations tab, choose a version of Xcode:

Locations preferences

Or you can manage versions from the command line using xcode-select:

# Print the currently selected version
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

$ clang --version
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

# Find all installed versions using Spotlight
$ mdfind 'kMDItemCFBundleIdentifier = "com.apple.dt.Xcode"'
/Applications/Xcode.app
/Applications/Xcode72.app

# Check their version numbers
$ mdfind 'kMDItemCFBundleIdentifier = "com.apple.dt.Xcode"' | xargs mdls -name kMDItemVersion
kMDItemVersion = "7.3"
kMDItemVersion = "7.2.1"

# Switch to a different version
$ sudo xcode-select --switch /Applications/Xcode72.app

$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.4.0
Thread model: posix

Stats

Contributors: 1
2016-04-04
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook