I have a new Macbook. I bought it, use time machine to move to it, and it copied everything and xCode runs fine, but when I go to the terminal and type gcc it says command not found.

How do I get GCC ?

link|improve this question

What version of Mac OS X and Xcode? – Daniel Beck Jan 27 at 20:33
Lion and the latest version of xCode – Snow_Mac Feb 1 at 3:02
feedback

3 Answers

up vote 1 down vote accepted

gcc is in /Developer/usr/bin and /usr/bin. Check these directories and the value of your PATH environment variable, and add to it as needed.

link|improve this answer
How do I do that? – Snow_Mac Feb 1 at 3:01
What specifically? – Daniel Beck Feb 1 at 8:24
feedback

I think the ultimate answer is: Get used to clang.

According to this discussion at Ars Technica and this email from the Glascow Haskell Compiler mailing list, gcc is no longer distributed with Xcode 4.2 and clang is the new default, with llvm-gcc provided so that developers can port to clang.

You might also find answers to this StackOverflow question useful.

link|improve this answer
gcc is a symlink to llvm-gcc, and should still be available. – Daniel Beck Jan 27 at 20:56
I need GCC, not clang or anything else. How can I get this on Mac? – Snow_Mac Jan 30 at 20:02
If you need real GCC, I think you'll have to install from MacPorts or similar. If you're writing Mac software, Apple's already told you it's on the way out as far as they're concerned. – afrazier Jan 30 at 21:18
I'm writing software that will be compiled and tested on Linux environments but I need GCC to compile and test within my Local Machine. – Snow_Mac Jan 31 at 5:06
feedback

With the latest Xcode, you first need to "Install Command Line Tools" - See the "preferences...", Download panel to do this.

Once you do that, gcc will be in /usr/bin

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.