Reputation: 4614
I am attempting to compile a package on my Mac laptop and my Mac Mini desktop. It compiles successfully on the laptop, but not the mini (gives the following error: gcc: error: unrecognized command line option '-Xarch_x86_64'
). Both machines are running OS X Yosemite (10.10.2). On both machines, when I type
which gcc
I get:
gcc: aliased to nocorrect gcc
(I don't know what this means) When I type
echo $PATH
I get:
/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
This makes me think that if a gcc is found in /usr/local/bin, that's the one that will be my gcc. When I type
ls -l /usr/local/bin/gcc
I get:
/usr/local/bin/gcc -> /usr/local/bin/gcc-4.8
on both machines. However, when I type
gcc --version
on the Mini I get:
gcc (Homebrew gcc48 4.8.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and on the laptop I get:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
Which is the version installed by XCode. (This is what I get on both machines from /usr/bin/gcc --version
)
How is the laptop using gcc 4.2 when the first gcc in my path is a symlink to gcc 4.8, and how do I make the mini do the same?
Upvotes: 1
Views: 4810
Reputation: 2143
When which gcc
returns something like gcc: aliased to nocorrect gcc
, the way to get the actual path would be to unalias foo, like this:
$ unalias gcc
$ which gcc
/usr/bin/gcc
This will remove the alias for the current shell, and you'll have to open up a new terminal or re-alias it yourself.
If you'd rather not do that, then you can use bash to determine the where the command is coming from:
$ bash -c 'which gcc'
/usr/bin/gcc
Upvotes: 1
Reputation:
The nocorrect
prefix is a zsh construct that will inhibit spelling correction.
It looks like you may have installed a specific gcc version with homebrew on the Mac Mini and you're using the system compiler (or rather, the one installed with XCode command line tools) on the laptop.
If you don't want to use the gcc installed with homebrew, you can just do:
brew unlink gcc
That will make the symlink go away and you'll use the next compiler. Which is hopefully the one you want.
Upvotes: 1