PATH not searched properly for gcc version

Turner, Adrian Keith akt at lanl.gov
Tue Jul 3 17:02:43 UTC 2018


Dear Macports users,

I am running OSX version 10.12.6 and MacPorts 2.5.2. I have installed
version 7 of gcc with MacPorts:

/opt/local/bin/gcc --version
gcc (MacPorts gcc7 7.3.0_1) 7.3.0

When I just use "gcc" for the command however I get the OSX
pre-installed version:

gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)

However, my PATH environment variable is set up to find the MacPorts one
first:

printenv PATH
.:/Users/akt/anaconda2/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin

Also, interesting are the results of which and whereis:
which gcc
/opt/local/bin/gcc
whereis gcc
/usr/bin/gcc

How do I make my system find the correct version of gcc without
specifying the full path?

Many thanks
Adrian Turner



More information about the macports-users mailing list