set default gcc among different versions

Lawrence Velázquez larryv at
Sun Nov 17 23:11:45 PST 2013

On Nov 18, 2013, at 2:00 AM, Gmail <yangzf01 at> wrote:

> I have installed 2 versions of gcc. One is from Mac BUILT-IN. The other one is from macports. So how can I make the gcc installed by macports as the default gcc while I compile c program? BTW, in the /opt/local/bin directory, I can find gcc-mp-4.8 and gfortran-mp-4.8, instead of gcc and gfortran. I am not sure if this is correct.

That is correct. The executables are named that way to allow different versions of GCC to be installed simultaneously. You could just run those executables directly.

If you can't or won't do that, you can run "sudo port select --set gcc mp-gcc48" to create /opt/local/bin/{gcc,gfortran}, which will be symlinks to the actual executables.


More information about the macports-users mailing list