2

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?

Chris Kempson
  • 319
  • 1
  • 3
  • 13

4 Answers4

16

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:

enter image description here

Tim Keating
  • 6,443
  • 4
  • 47
  • 53
  • +1 This is the answer you should read now. But to be fair the accepted answer probably dates back from before Xcode was available from the App Store when these tools were supposed to be installed by default. Hopefully the OP will change his accepted answer. – Alex Jasmin Feb 18 '13 at 20:22
  • In my experience, that doesn't happen on SO. I'll settle for the upvotes :-) – Tim Keating Feb 18 '13 at 21:30
1

These binaries should be there after installing xcode. Check your path settings, and if you still don't have these reinstall xcode

ennuikiller
  • 46,381
  • 14
  • 112
  • 137
  • I have managed to find it buried in "/Developer/usr/bin/gcc-4.2". I wonder if "/usr/bin/gcc-4.2" is only a symlink to this and for some reason the XCode install didn't create these. Or perhaps my path settings should point to /Developer/usr/bin/? – Chris Kempson Nov 27 '09 at 19:42
  • I'm running snow leopard and gcc-4.2 is not a symlink: Fri Nov 27{stevenhirsch@steven-hirschs-macbook-pro-2}/projects/projects/scripts:-->ls -l /usr/bin/gcc-4.2 -rwxr-xr-x 1 root wheel 166128 2009-09-18 13:00 /usr/bin/gcc-4.2 – ennuikiller Nov 27 '09 at 21:46
  • Thanks very much, proof that something went very wrong somewhere along the lines then! – Chris Kempson Nov 28 '09 at 10:18
1

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

Patrick
  • 136
  • 1
  • 7
0

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.

Alnitak
  • 334,560
  • 70
  • 407
  • 495
  • Yes I installed the latest Xcode after installing Snow Leopard. – Chris Kempson Nov 27 '09 at 19:39
  • I'd go for an Xcode reinstall, then. And on my system /usr/bin/gcc-4.* is not a symlink, it's an identical copy of the files from /Developer/usr/bin/ – Alnitak Nov 27 '09 at 20:21
  • Reinstalled as you suggested and this fixed the problem. I'm not entirely sure why it didn't work the first time around but I'm glad it's all working now! – Chris Kempson Nov 28 '09 at 12:13