I'm very new to Mac and right now my operating system is 10.10 Yosemite. I installed XCode and Xcode CLT, gcc came along with it as well. I was asked to change the default compiler to gcc. I went online to this question here to find out how to do it - How to set gcc 4.8 as default gcc compiler

and these were the instructions I chose to follow (They seemed pretty straightforward) -

cd /usr/bin

rm cc gcc c++ g++

ln -s gcc-4.8 cc

ln -s gcc-4.8 gcc

ln -s c++-4.8 c++

ln -s g++-4.8 g++

But the problem is that now when I type gcc it says Command not found. Why is that? When I cd /usr/bin/ and ls I can see gcc, cc, g++, clang etc. It basically says the same message 'command not found' for these commands - cc gcc c++ and g++ (I was wondering why the instructions above mentioned to rm those 4 but this answer has been provided in multiple places so it must be correct.)

clang still works thankfully, although I still require gcc.

I also used sudo port install gcc49 to get gcc4.9 and I assumed it would have installed it perfectly, but I still get the same gcc error. Can anyone give me a step wise procedure on what I should do to get gcc, cc, g++ and c++ working again?

Again - Mac newbie here. Please be kind :(

  • $ gcc --version
    – Ruskes
    Commented Nov 5, 2014 at 4:00
  • @Buscar웃 This is the output I still get - -bash: gcc: command not found
    – Srihari S
    Commented Nov 5, 2014 at 6:11
  • do you need to install the command line tools ? osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x
    – Ruskes
    Commented Nov 5, 2014 at 6:29
  • I already installed it. Does the environment variable have to be added to bash manually? Not that I know how to do that either. :\
    – Srihari S
    Commented Nov 5, 2014 at 6:33
  • type /usr/bin/gcc and see what happens
    – Camden
    Commented Dec 27, 2017 at 2:57

1 Answer 1


If your filesystem is case sensitive, then you probably meant to enter gcc instead of GCC

  • I apologize for the mistake in the question I posted. I used lowercase only.
    – Srihari S
    Commented Nov 5, 2014 at 6:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .