Apple - How do I use GCC on El Capitan?

Instead of invoking using gcc you need to call gcc-4.9. Alternately you could create an alias for gcc to point to gcc-4.9(although that is risky).


For anyone who stumbles upon this currently (like I did), I found that I needed to locate my version of gcc (which I had installed with brew). This is annoying when gcc --version gives the clang version instead! To find the correct gcc version, run

$ ls /usr/local/opt/gcc/bin | grep gcc
gcc-10
gcc-ar-10
gcc-nm-10
...

So I had gcc-10. Whenever you wish to use gcc just replace it with gcc-10, e.g. man gcc-10. Of course you could write an alias for gcc to gcc-10, but this probably is not a great idea as Xcode seems to rely on the gcc --> clang simlink.

Tags:

Gcc