Xcode and gcc problem.

Installed Xcode from AppStore,

but still get the message when i run gcc in terminal:


-sh: gcc: command not found


Anyone?

MacBook Pro, Mac OS X (10.7.3)

Posted on May 22, 2012 2:57 AM

Reply
10 replies

May 22, 2012 3:21 AM in response to XeeeNa

Because gcc is not on your default execution path. You need to explicitly reference the full pathname to gcc or add the directory it is in to your shell's $PATH variable.


In my 10.6.5 system gcc is in /usr/bin. So I have /usr/bin in my $PATH (among other possible execution paths for other stuff).


Xcode installs the developer tools. But it is not its job to set your shell's PATH definition. That's your responsibility.


By the way is there some reason you are running sh and not bash?

May 22, 2012 3:29 AM in response to X423424X

I figured that out now too.

When I last where running an Xcode install I was on SL

and It all worked fine afterwards.

Did not have to add anything in my $PATH.

But now on Lion I have to..


Nope - I'm always running bash.

Just finnised a fresh install of lion an well,

when running as none-superuser i've got bash shell,

but as root sh - apperently. Strange. 😕

May 22, 2012 12:35 PM in response to XeeeNa

XeeeNa wrote:


I figured that out now too.

When I last where running an Xcode install I was on SL

and It all worked fine afterwards.

Did not have to add anything in my $PATH.

But now on Lion I have to..


Nope - I'm always running bash.

Just finnised a fresh install of lion an well,

when running as none-superuser i've got bash shell,

but as root sh - apperently. Strange. 😕

baltwo wrote:


AFAIK, that's not true for Xcode 4.3.2. The CL tools are installed inside the Xcode app and don't require a developer account.


Well accorting to what baltwo says that explains why you need to explicitly fix up PATH (to add the appropriate directories withing the xcode bundle).


As for running gcc from your root account? Why on earth would be running it from there at all?

May 23, 2012 12:02 AM in response to X423424X

Oh - Im a frequent user of macports, well was untill now.

That's the reason why I install Xcode.


But as I now have made afresh install of lion

Xcode have apparently been changed - a lot.


As I understand it gcc has been the compiler collection MacPorts has used by default up until Xcode 4,

in which Apple has switched to the llvm/clang compiler collection.


I have not been experincing problems untill now.

And It seems I'm not the only one experiencing probems with v4.3

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Xcode and gcc problem.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.