Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm currently running GCC 4.2. I would like to switch to a more recent version.

I have Homebrew and I have MacPorts for package management. I've followed several tutorials today for installing a newer version of GCC, but everytime I get finished and type gcc -v and I still get that I'm using 4.2. How can I switch this? If you need more info let me know, I'm pretty new to system packages.

share|improve this question
    
Why do you want gcc, what stops you using Apple's clang? –  Mark Oct 24 '13 at 11:33

2 Answers 2

Just a quick question: do you properly set the PATH environment variable, i.e. put the path of newer version of GCC (you just installed) before the path of GCC 4.2 (maybe the system default), so that when your operating system looks for needed executable, it will find the newer version first?

share|improve this answer
    
I do not, where can this be done? Some places mention a ".profile", which I believe in Mac OSX Lion is my ".bash_profile". If this is the correct file, what is the syntax for adding it? If it is not the correct file, where can I add this PATH environment variable? –  Donny P Sep 23 '13 at 0:04

As far as I know, Homebrew installs gcc with version suffix. For example I have gcc 4.8 installed and it is available as gcc-4.8. Try to check if you have the same pattern of files.

share|improve this answer
    
Thanks for the answer @eiennohito, yes it does install with a version suffix. How can I make my Mac use this newer version instead of the old gcc 4.2? –  Donny P Sep 23 '13 at 4:11
    
If you want to compile something yourself do the CC=gcc-4.8 CXX=g++-4.8 ./configure then make as usual. –  eiennohito Sep 24 '13 at 4:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.