Yosemite GCC Woe


08-28-2014


Filed under: gcc, ruby, yosemite

There have been many discussions online regarding to the problem of installing Ruby on Yosemite with verion managers such as rbenv. Most of the problems have to do with confusions around gcc/cc.

Some typical errors include:

configure: error: something wrong with CFLAGS=" -O3 -Wno-error=shorten-64-to-32  "

and

couldn't understand kern.osversion `14.0.0'

Most of these issues can be resolved by ensuring that you have linked correct version of gcc with XCode.

At the time of writing, XCode6 is at beta6. Open XCode -> ‘Open Developer Tool’ -> ‘More developer tools’. This should take you to an apple site where you can download the proper version of commandline tool for Yosemite.

Once you install the commandline tool, open up Preferences of XCode, then select the ‘Location’ tab. Under locations of Command Line Tools, select Xcode 6.0 from the drop down.

Now if you open terminal and type gcc -v, you should see:

Configured with: --prefix=/Applications/Xcode6-Beta6.app/Contents/Developer/usr

The important bit is that –prefix points to the correct path in Xcode6-Beta6.app.

Now rbenv install 2.1.2 and the like should work.