I installed Xcode but I still don't have gcc in my terminal

I just got a Mac and I'm a complete newbie, so this may be kind of a really easy question, but I wasn't able to solve it with Google or F1.

I was trying to run a C program from the Terminal that comes with mac, but when I used gcc test.c, it said -bash: gcc: command not found. I looked up the error on Google and discovered that I needed to download Xcode. I did that and installed it (I think, after all it runs), but I still don't have gcc in my Terminal. What can I do?


Great question — this recently changed, so I suspect many other people are wondering the same thing.

In the latest version of Xcode, the command line tools are distributed as a separate package. Luckily they're very easy to install:

  • Open Xcode, and open the Preferences window (+,).
  • Switch to the Downloads tab.
  • Click "Install" (or "Update") next to "Command Line Tools". You can also configure automatic updates, and additional Xcode components.

Note: since these tools are actually a completely separate package, you can install the command line tools without installing Xcode, if you don't need Xcode and want to save some disk space. They can be downloaded separately from the Apple developer site.


If the command-line tools are all you need and you don’t really need Xcode, then there’s a much more efficient way to install these tools that doesn’t require you to download multiple gigabytes of data.

Simply download the “Command Line Tools” package from Apple Developer (free account required; you can use your Apple ID). As of this writing, the package is named “Command Line Tools for Xcode - Late March 2012”. It’s a 171.70 MB disk image, which pales in contrast to the 4+ GB Xcode download.

Note that, if you’ve already installed Xcode, you’ll want to uninstall it before installing the Command Line Tools.


This is the expected behaviour, Xcode now uses LLVM as the default compiler. Starting with Xcode 4.3 gcc is not included anymore, distributed builds is not available anymore either.

If you want gcc you will have to download the separate package named "Command Line Tools for Xcode" from Xcode as described in this answer.