Getting the Lion C/C++ Compiler

Unfortunately for developers like me, Mac Lion does not come with GCC, G++ or anything else pre-installed on the computer (plus the compilers are not GNU standard, so you can’t update them by compiling a newer version).

However, Apple has produced a disk image with an installer for these tools, if you want command-line tools like me, or you can download Xcode and use that instead.

If you have Xcode and want the command-line tools, all you have to do is go to the Xcode menu while Xcode is open, choose the Preferences item, click on the Downloads tab and press the button saying you want to install the command-line tools.

If you want Xcode, go to the App Store and download it. Personally, I like having both, mainly because I like the structure of Xcode for certain projects, but I enjoy the flexibility of the command line. Plus, it is simpler to update the command line tools through Xcode because it informs you of updates. Of course, this can be undesirable; I had to recompile some custom libraries that I had installed because of changes in the updates…

If you just want the command-line tools, follow these steps:

  1. Go to the Apple Developer’s Download page (This requires that you have a Developer Profile. You can get one for free, so you might as well.)
  2. Click on the latest version of the Command Line Tools
  3. On the right side of the screen there will be a link to the file. Click it and it will start the download.
  4. Once it has finished downloading, open the disk image and install the package.

NOTE: You need to have Administrator Privileges to install the command line tools!