Last Updated: February 25, 2016
· jodosha

Getting Mac OS Lion GCC to work again

Last week I made a mistake: I updated XCode from the Mac App Store, and suddenly gcc stopped working, with this error:

configure: error: C compiler cannot create executables

The strange thing was that gcc itself still can compile code, I tried with a stupid hello_world.c, but by looking at the logs of the software I was trying to install there was a strange output:

configure:3436: /usr/bin/gcc-4.2 s-g -02   conftest.c  >&5
i686-apple-darwin11-gcc-4.2.1: s-g: No such file or directory

I guessed was something about compiler optimization, so I tried to turn off at all (-O0) and it worked:

$ CFLAGS=-O0 rbenv install 1.9.3-p194