Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change GCC Version to 4.7 on Mac OS X

Tags:

macos

gcc

g++

On OS X, I currently have a couple versions of gcc installed. Whenever I use gcc -v or g++ -v, it tells me: gcc version 4.2.1. I have installed gcc 4.7, though, in the interest of taking advantage of C++11. How can I change it so that gcc/g++ points to 4.7 instead of 4.2.1?

EDIT: I have homebrew, not macports.

like image 456
muttley91 Avatar asked Jan 26 '13 06:01

muttley91


1 Answers

I think you can do something like this. Go to /usr/bin

Assume you have install the gcc-4.7 using home brew in mavericks. then type:

cd /usr/bin
sudo mv gcc gcc_mavs
sudo ln -s /usr/local/Cellar/gcc48/4.7.0/bin/gcc-4.7 gcc

After this type to verify if you have select the right gcc compiler.

gcc -v

like image 199
BITTNT Avatar answered Nov 13 '22 15:11

BITTNT