Reputation: 579
Pretty new to this kind of development. Wondering if anyone can point me in the right direction. As far as I can see it, using MacPorts has an error where it doesn't work. However, I was reading around and saw this: http://beardedcodewarrior.net/2011/07/25/building-gcc-4-6-1-on-mac-os-x-lion/ but still couldn't get it to work. When I executed make for gcc, it took over 3 hours to complete and then once I execute sudo make install, it completed successfully but when I try gcc --version, it still says gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00). I need the 4.6.1 version!
Upvotes: 4
Views: 6102
Reputation: 400592
There are three likely possibilities:
$PATH
than your previous GCC installation, but Bash's internal hash table entry is still pointing to the old GCC.$PATH
than your previous GCC installation.gcc
.If #1, just run the command hash -r
and try again. In order to avoid frequent $PATH
lookups, Bash uses a hash table to map executable names into executable locations. When you install a new executable earlier in your $PATH
with the same name as one later in the $PATH
, Bash doesn't know about it. Running hash -r
says "clear out your hash table". Alternatively, you can just run hash -d gcc
to say "forget about gcc in your hash table".
If #2, then you either need to execute gcc by its full name (e.g. /opt/local/bin/gcc
), or modify your $PATH
so that the directory containing the new gcc is earlier than the directory of your existing gcc. Assuming you installed MacPorts normally, that should already be done for you—MacPorts puts /opt/local/bin
earlier in your $PATH
than /usr/bin
by modifying your ~/.bash_profile
startup file.
If #3, then figure out what name the executable was given. It was almost certainly given a name prefixed with gcc, so if you type gcc and then hit the tab key twice, Bash will give you a list of all of the commands that begin with gcc. It's quite likely it was given a name likw gcc-4.6
or gcc-mp-4.6
.
Upvotes: 3