MacOS – How to reinstall gcc

developmentgccmacosxcode

Im new with mac and tried to install gcc / g++ on an MacBook Air with El Captain. I installed Xcode and used

xcode-select --install

It completed and was successful. However, for some reason I cannot find any version of gcc / g++ in /usr/bin or anywhere else besides the symlinks (cc c++ gcc g++) that point to nothing. I tried

gcc -v

and received the error

-bash: gcc: command not found

And when I try to reinstall the command line tools again with code-select I get

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Is there any way I can simply start over with the install of the command line developer tools?

Best Answer

Is Xcode installed in the normal location? (i.e. in /Applications?)

What do you get back from,

$ xcode-select --print-path

Can you see gcc at the following location,

$ ls -l /Applications/Xcode.app/Contents/Developer/usr/bin/gcc
-rwxr-xr-x  1 root  wheel  18560 16 Mar 00:31 /Applications/Xcode.app/Contents/Developer/usr/bin/gcc

If the path from xcode-select is not pointing to /Applications/Xcode.app/Contents/Developer then try forcing to this location,

sudo xcode-select --switch /Applications/Xcode.app