After I installed Macports (and after that I have installed several versions of gcc through Macports), whenever I type gcc, one of those gcc installed through Macports will be invoked.

Before I installed Macports, whenever I type gcc, clang that comes with XCode will be invoked. (not sure this is true)

Now I need to compile a 3rd-party package with clang, but I don't know how I should do.

My question is: now that Macports (w gcc48) has been installed, what should I do to switch back to the setting where gcc is linked to clang that comes with XCode?

3 Answers 3


In Terminal:

nano ~/.bash_profile

find the line that looks like this:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

comment it out by putting # in front of it.

  • 3
    That will exclude every bin install by Macport ... Definitely not the best idea. May 5, 2014 at 7:41

If you want to avoid uninstalling or changing your PATH. Just run:

sudo port select --set gcc none

…and to re-enable it you run:

sudo port select --set gcc gcc5

You have to remove it from your $PATH.

One off your possibilites is to just uninstall it : sudo port uninstall gcc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .