How can I ensure that gcc
points to a particular compiler? Can I make a permanent symbolic link to the xcode
version of gcc
?
I have several versions of the gcc
compiler installed on my system, including
`gcc-11` found at `/usr/local/gcc-10/share` (compiled from source following these [instructions][1])
`gcc-9.3.0` found at `/usr/local/Cellar/gcc/9.3.0_1/share`
`gcc-4.8.5` found at `/Users/PatrickT/miniconda/pkgs/gcc-4.8.5-8/share`
The default version is gcc-4:
gcc --version
gcc (GCC) 4.8.5
which gcc
/Users/PatrickT/miniconda/bin/gcc
This miniconda version of gcc
is not working for me. If I remove miniconda from the PATH, my system reverts to another version of gcc
and everything works as expected. However, I do use miniconda's Python and would therefore like to keep it on my PATH. In my .zhrc
profile (apparently, MacOS Catalina has moved the .bashrc
to .zhrc
), I have:
export PATH="/Users/PatrickT/miniconda/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/Cellar/gcc:$PATH"
export PATH="/usr/local/gcc-10/bin:$PATH"
I have tried to change the order of these lines, but it has made no difference: miniconda's gcc
remains the default compiler, unless I remove the first line completely, but then... I'm unable to use conda's Python!
Background: I'm not using the gcc
directly, but I appear to need it to compile certain scripts. I have both the xcode
command line tools and the xcode
application, if that matters. I'm on MacOS Catalina 10.15.4.