I don't think your port select command did what you expected. The manual states that the select command selects between multiple versions of a versioned port, which I believe is not your case here:
pejvan$ port help select
Usage: select --list --set --show --summary <arguments>
Select between multiple versions of a versioned port
This allows you to choose which version, among several installed versions
of a port, is to be considered primary. What this means is which version
becomes the one most would consider the default, e.g. the one run without
specifying any version.
After you successfully run the install command for gcc (here version 4.9):
sudo port install gcc49
You can verify you've got the gcc binaries installed:
pejvan$ ls -l /opt/local/bin/gcc*
-rwxr-xr-x 2 root admin 42912 3 Jun 03:44 /opt/local/bin/gcc-ar-mp-4.9
-rwxr-xr-x 3 root admin 1082788 3 Jun 03:44 /opt/local/bin/gcc-mp-4.9
-rwxr-xr-x 2 root admin 42992 3 Jun 03:44 /opt/local/bin/gcc-nm-mp-4.9
-rwxr-xr-x 2 root admin 43000 3 Jun 03:44 /opt/local/bin/gcc-ranlib-mp-4.9
You can then run gcc with the full path to the binaries:
pejvan$ gcc-mp-4.9 --version
gcc-mp-4.9 (MacPorts gcc49 4.9-20140416_2) 4.9.0 20140416 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you want to replace (temporarily or permanently) the clang complier by gcc, you can do it by setting the CC env var the following way for example:
export CC=/opt/local/bin/gcc-mp-4.9 # set GCC as default C compiler
As a side note, please note that for the port select gccVersion
to work, you will need to install gcc_select
:
pejvan$ port info gcc_select
gcc_select @0.1_8 (sysutils)
Description: gcc_select installs files that allow 'port select' to switch the default version of gcc. It symlinks the standard compiler executables in
the MacPorts prefix to the selected version.
I haven't looked at the details of the package, so I'm not sure whether it would work between clang and port installed gcc or only with several different versions of port installed gcc packages.
which gcc
give?