PATH not searched properly for gcc version

Turner, Adrian Keith akt at
Tue Jul 3 21:36:31 UTC 2018

Many thanks, using a new shell did the trick. I was not aware things
like that were cached. I did indeed use port select.


On 7/3/18 3:32 PM, Rainer Müller wrote:
> On 2018-07-03 21:15, Ryan Schmidt wrote:
>> On Jul 3, 2018, at 12:40, Rainer Müller wrote:
>>> On 2018-07-03 19:02, Turner, Adrian Keith wrote:
>>>> Also, interesting are the results of which and whereis:
>>>> which gcc
>>>> /opt/local/bin/gcc
>>>> whereis gcc
>>>> /usr/bin/gcc
>>> That is normal, whereis does not respect PATH.
>>>> How do I make my system find the correct version of gcc without
>>>> specifying the full path?
>>> Your shell has probably cached the location of the gcc binary from
>>> earlier before you created the symlink with 'port select'. Just open a
>>> new terminal window or execute 'hash -r' to clear the cache.
>> Adrian didn't say he had used 'port select'. If he hasn't, that's the first thing he should do, if he wants to be able to use gcc 7.3 as "gcc".
> Nothing else would provide /opt/local/bin/gcc, so I assumed he used that...
> Rainer

More information about the macports-users mailing list