Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

brent1a

macrumors member
Original poster
Jan 9, 2005
58
4
I've successfully compiled and installed the newest gcc (4.3.2). How do I make Leopard use it now instead of it's default gcc 4.0?
thanks in advance
-b
 

darkwing

macrumors 65816
Jan 6, 2004
1,210
0
I've successfully compiled and installed the newest gcc (4.3.2). How do I make Leopard use it now instead of it's default gcc 4.0?
thanks in advance
-b

You don't want to try and change to a non-apple supplied GCC. They patch it to support their various extensions for OSX. You can use your new gcc to build your posix apps, but if you try and replace your dev tools with it you'll have problems.

If you want to use it yourself from the command line by default, you should put /usr/local/bin in your path ahead of /usr/bin and /bin. Because Apple sucks, I had to add the following line to my ~/.bash_profile:

export PATH=/usr/local/bin:$PATH

(This is assuming you installed gcc-4.3.2 to /usr/local/bin which you should have done.)
 

brent1a

macrumors member
Original poster
Jan 9, 2005
58
4
I definitely don't want to try and replace what Apple has provided. I just want to try and use the new one from the command line.
However, since I'm a newb at the command line if you could please expound on what exactly I should add to my "sudo ./configure" "sudo make" commands so that I use the gcc-4.3.2 I'd be grateful. I'm not sure I completely understand what you've told me so far.
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
If you want to use it yourself from the command line by default, you should put /usr/local/bin in your path ahead of /usr/bin and /bin. Because Apple sucks, I had to add the following line to my ~/.bash_profile:

export PATH=/usr/local/bin:$PATH

(This is assuming you installed gcc-4.3.2 to /usr/local/bin which you should have done.)

Most BSD systems require that as they will only search system paths by default.
 

brent1a

macrumors member
Original poster
Jan 9, 2005
58
4
I had to add the following line to my ~/.bash_profile:

export PATH=/usr/local/bin:$PATH

(This is assuming you installed gcc-4.3.2 to /usr/local/bin which you should have done.)

I understand about adding that to my .bash_profile but where exactly is that at? I can't seem to find it anywhere.

Can I just do this to add it permanently?

echo "export PATH=\"/usr/local/bin:$PATH\"" >> .bash_profile
 

darkwing

macrumors 65816
Jan 6, 2004
1,210
0
Most BSD systems require that as they will only search system paths by default.

Actually /usr/libexec/path_helper hard codes in the system paths and doesn't let you change their order. So adding /usr/local/bin to the paths won't work because defaults always go first. System level scripts should use absolute paths anyway. For the rest of what you do, you should be able to "replace" your system files by putting new versions or whatever in /usr/local and your own scripts will use those instead.

brent1a, you can use any text editor or anything to edit your .bash_profile file in your home directory. You will need to use the terminal, however, in order to edit it. You can make it easy on yourself by typing this in terminal:

open -a TextEdit ~/.bash_profile
 

brent1a

macrumors member
Original poster
Jan 9, 2005
58
4
.bash_profile does not exist?!?!?!

So I added /usr/local/bin to my .bash_profile however-
what you are saying is that adding export PATH=\"/usr/local/bin:$PATH\ wouldn't get the results that I would like, having gcc-4.3.2 used instead of the system gcc?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.