Skip to main content Skip to navigation

Selecting the development tools in OS X

On OS X there are two options for running basic unix commands such as ls and gcc:

  1. Install Command Line Tools
  2. Install X-code

However, these tend to include different versions of the gcc compiler. It is quite possible that after having installed X-code you want to check that the code will still work with the older version of the compiler that tends to be distributed with Command Line Tools. For example, at the time of writing gcc in Command Line tools did not support thread_local variables, whereas the gcc in XCode does.

Switching between the two is done with xcode-select

To show the command tool set currently being run use:

xcode-select -p

To change to the Command Line tools commands use:

sudo xcode-select -s /Library/Developer/CommandLineTools

and to select the XCode tools use

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/