问题
I have installed the developer tools. I can compile code via Xcode and according to the docs /usr/bin/gcc & /usr/bin/cc should point to /usr/bin/gcc-4.0. Neither the symlinks or gcc-4.0 exist on my system (Snow Leopard). All I wish to do is compile some C on the terminal! I'm amazed by how complicated this task is. The command GCC is unsurprisingly returning "gcc: command not found".
Can anyone shed some light on this?
回答1:
Did you install the latest Xcode after installing Snow Leopard, or is this the version of Xcode from a previous OS installation?
On my system with a clean Snow Leopard install the default compiler (and the one symlinked from cc and gcc) is gcc-4.2
I do have gcc-4.0 too, although it's not the default.
回答2:
No! Reinstalling is the wrong answer!
Newer versions of XCode require you to install the command-line versions of the tools separately. In XCode, go to Preferences | Downloads, check the Components tab, and install them from there:
回答3:
These binaries should be there after installing xcode. Check your path settings, and if you still don't have these reinstall xcode
回答4:
Command line tools are no longer included with the latest XCode (even as an add on). Now you can download them here:
https://developer.apple.com/downloads/index.action
来源:https://stackoverflow.com/questions/1810327/cant-use-gcc-in-os-x-terminal