Xcode: Selecting versions for command line

rvm is great, so is nvm! Bundler is cool, too. They all let you manipulate the versions and environments on your command line. Want Node 6.7.0? No problem! Want the latest Ruby and latest Node at the drop of a hat. No worries.

When it comes to Xcode, there are versions and environments like this, too.

For instance, if you get an error like this:

xcrun: error: SDK "iphonesimulator" cannot be located

Check the result of this command:

xcode-select --print-path

This might lead to an Xcode.app (which is GOOD) but it might lead to a copy of CommandLineTools (which is not as good). The Command Line Tools do NOT include the iOS SDK stuff you need to run cocoapods and most Xcode project commands.

To straighten things out, run this:

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

Now you should be all set. :)