I have the gcc compiler in "/Developer/usr/bin/gcc" but when i type in gcc into terminal it says can not be found, i assume this is because its not in the "/usr/bin" dir. So can i a) move gcc from the first dir to the second, or set some kind of shortcut pointing gcc to "/Developer/usr/bin/gcc"
Use ln -s
to create a symlink in /usr/bin
, or add /Developer/usr/bin
to $PATH
.
Two choices:
- Edit your
~/.bashrc
or~/.bash_profile
(or equivalent system files) and add/Developer/usr/bin/gcc
to$PATH
:export PATH="$PATH:/Developer/usr/bin/"
- Create a link (symlink in this example) in your
/usr/bin
directory pointing to the real file:ln -s /Developer/usr/bin/gcc /usr/bin/gcc
You can, in theory, hardlink it to the proper place.
The official way to do this is to install the optional "command-line tools" with the XCode installer. This wastes several hundred megabytes as it installs a new copy of the same compiler.
I wrote a shell script once to compare the installation trees of the "XCode" installation and the "command-line" installation and hardlink together all the files that were identical. It worked perfectly but the next upgrade undid it.
Another alternative is to download the GCC source from their CVS (not much bigger than downloading the massive XCode installer), and build it into usr/bin/
yourself. Then you have the latest and greatest (or your choice of many newer and better versions) to play with.