Installing a command line C compiler for Mac OS X 10.7 (Lion)

Setting up lab images for this semester, I needed to compile source code for the expat XML tool, and discovered to my annoyance that Lion doesn’t include a C compiler. A quick Google suggested installing Xcode from the Mac App Store. Did this, and still no joy.

Turns out that as of Xcode 4.3.2, command line compilers are no longer installed by default. To fix this:

  1. Download and run the Xcode app from the MAS.
  2. Open Xcode’s prefs, and click Downloads.
  3. Find the Command Line Tools entry and click Install (it’s 180MB at this time, and you’ll be required to authenticate).
  4. When it’s finished, switch to Terminal and issue the command gcc -v. If you get anything other than “-bash: gcc: command not found”, win!
About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s