I've installed gcc-5 via brew install gcc5
, and I've tried linking gcc (which is clang by default) to gcc-5, but whenever I try running gcc, it's using clang. I've also checked that /usr/local/bin
is first in my PATH variable. Here's how it all looks in my terminal:
$ which gcc-5
/usr/local/bin/gcc-5
$ which gcc
/usr/bin/gcc
$ echo $PATH
/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/.composer/vendor/bin:/usr/texbin
$ gcc
clang: error: no input files
$ gcc-5
gcc-5: fatal error: no input files
compilation terminated.
$ ln -sf gcc-5 gcc
$ gcc
clang: error: no input files
Also, in ~/.bash_profile, I've put export PATH="/usr/local/bin:$PATH"
in the last line of the file, and it appears 1st in $PATH, I've played around a bit and discovered that it's somehow read in reverse, as if every export appends to the front, is that normal behaviour?
EDIT:
I would prefer to avoid using alias for things like these.
Best Answer
You might be thinking of an alias, but that symbolic link doesn't really do anything unless you're in /usr/local/bin. You need