12

I have installed Xcode from the Tool cd, I thought that would let me use gcc from the command line but I can't find it.

What am I missing

EDIT

When I wrote I can't find it I meant "I look for it using which gcc"

If gcc would have been in the PATH in first place, which would have find it.

Since gcc is not in the PATH ( that's what brought me here in first place ) which won't find it!

I think that was obvious but I'm making the note here because it wasn't

OscarRyz
  • 196,001
  • 113
  • 385
  • 569
  • 2
    I'm voting to close this question as off-topic because too old and out of date. No longer applicable – dawg Sep 22 '16 at 03:04

8 Answers8

40

As of version 4.3.1, XCode is now an application and the command line tools are now available through the Preferences (this is documented in the App Store for XCode under 'What's New in Version 4.3.1' if you click 'More...'). After installing XCode, open it, open the Preferences and click on the Download tab. Click on 'install' for the 'Command Line Tools' and then sign in with your computer's password. The code will then be downloaded and installed.

Community
  • 1
  • 1
Bob Swerdlow
  • 542
  • 7
  • 7
8

You didn't check the box that says "UNIX Development Support"[1] (or possibly you unchecked it; I can't remember if it's on by default or not) when you did the install, so it didn't install the necessary symlinks and drivers in /usr/bin/.

Reinstall, and make sure to read the descriptions of the configuration options and select the ones that you need.

1: "Optional content to allow command-line development from the boot volume. Installs a duplicate of the GCC compiler and command line tools blah blah blah..."

Stephen Canon
  • 103,815
  • 19
  • 183
  • 269
5

Something went wrong with your install.

gcc is installed under /usr/bin with a symlink to gcc-4.2:

cd diciu$ pkgutil --file-info /usr/bin/gcc-4.2 
volume: /
path: /usr/bin/gcc-4.2

pkgid: com.apple.pkg.gcc4.2Leo
pkg-version: 4.2.0.9000000000.1.1249367152
[..]
pkgid: com.apple.pkg.Xcode3.2.1Update
pkg-version: 1.0.1.1249367152
[..]
pkgid: com.apple.pkg.Xcode3.2.1UpdateUNIXDevSupport
pkg-version: 1.0.1.1249367152
[..]
diciu
  • 29,133
  • 4
  • 51
  • 68
4

On my Mac $ which gcc displays /usr/bin/gcc.

maerics
  • 151,642
  • 46
  • 269
  • 291
  • Is it possible that `which` returns something if the command doesn't work in first place? – OscarRyz Apr 21 '10 at 19:45
  • 1
    no, he was just telling you where gcc is SUPPOSED to be. he's saying where gcc is on HIS mac – Brian Postow Apr 21 '10 at 20:15
  • @Brian Oh.. then that's a comment, not an answer – OscarRyz Apr 22 '10 at 01:09
  • no, it's an answer to your question "Where is gcc on OSX"... the answer is "it should be in /usr/bin" – Brian Postow Apr 22 '10 at 13:29
  • @Brian Well, actually the question was "What am I missing" but the obvious answer you've been *"gcc of course!"* so, nevermind. I get your point anyway and it is valid. – OscarRyz Apr 22 '10 at 18:22
  • Sorry if I broke protocol, the question title is "Where is gcc on OS X" so I responded; I wasn't trying to offend or make a smart-ass answer. (FWIW I upvoted an other answer with better info.) What are the guidelines for providing an answer vs a comment to the question? – maerics Apr 22 '10 at 20:50
3

Xcode 4.3+ you need to install 'Command Line Tools for Xcode' found here: https://developer.apple.com/downloads

Jeremy Rowe
  • 109
  • 1
  • 4
1

Is it possible that rather than not having gcc installed, your $PATH variable is messed up? first check if gcc is in /usr/bin manually. Then echo $PATH...

Brian Postow
  • 11,709
  • 17
  • 81
  • 125
1

The same thing happened to me. It worked for a while and then went away. Reinstall and it will be fixed.

You might want to download Xcode from Apple while you are at it. Almost guaranteed to be fresher / more up-to-date since Xcode is rapidly updated. Current Xcode is 3.2.1.10. You need an Apple ID to download, but that also gives you access to the development site. All free... .


It is 1/6/2014. Current Xcode is 5.0.1


It is 2016 -- Current Xcode is 8.0. I think this question should be closed now.

dawg
  • 98,345
  • 23
  • 131
  • 206
  • +1 @drewk Thanks, I tried do downloaded it from I couldn't pass the firewall ( or the antivirus I don't know ) so today I brought my install CD and this is what happened: http://stackoverflow.com/questions/2693336/how-to-update-xcode-to-install-unix-development-support :( – OscarRyz Apr 22 '10 at 18:25
0

Yes, try to install 'command line tools' by clicking Preferences-Downloads-command line tools.

Elaine
  • 395
  • 2
  • 10