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)
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)
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?
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. 😕
Did you install gcc? You have to download and install the command-line tools after installing Xcode. It is done from within Xcode. (I think it's in preferences — I don't have Xcode in front of me at the moment.)
It's under the Xcode menu -> Open Developer Tools -> More Developer Tools. But you have to have a developer account to log in.
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.
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?
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
Some more info about known issues
When have you ever known apple to leave well enough alone. Change is the only constant for the developent tools (ok, and the rest of OSX as well). 😟
gcc is still available, but you have to download the Developer Tools, as I said earlier. Xcode has its own compilers built in, but I doubt that that will work with MacPorts. Gerry Brown told how to get to the download page.
Xcode and gcc problem.