MacOS – GCC : Command not found

command linedevelopmentgccmacosxcode

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 🙁

Best Answer

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