I am struggling to build a climate model that depends heavily on C and Fortran compilers installed on the machine.
I installed XCode and its default compilers, but I had to install more recent versions from MacPorts since I need updated compilers.
Therefore, I currently have two distinct versions of the compilers installed on my Mac (using here gcc as an example, but it is the same with gfortran):
gcc, from XCode, installed on /usr/local/bin/gfortran
gcc-mp-4.9, from MacPorts, installed on /opt/local/bin/gcc-mp-4.9
What I need to do is to set gcc-mp-4.9 as the default gcc compiler of the system, for any purpose at all. I created an alias on my bash.profile:
alias gcc='gcc-mp-4.9'
which works if I just type gcc on terminal. However, if I type "which gcc", the system still detects the old version:
$ which gcc
/usr/bin/gcc
which causes me some troubles, because most of the libraries I have to build rely on the output of 'which' to determine the compiler to be used.
Without removing /usr/bin/gcc or creating symblic links, is there any way to indicate to the system that gcc-mp-4.9 is the default gcc compiler for any occasion?
Thanks in advance, Thiago.