Last Updated: February 25, 2016
· liquid

Installing Ruby Enterprise Edition on OS X 10.9 Mavericks

Just a quick brain dump for future reference:

(I should improve this article at some point later on but I currently have no time to do that, sorry)

First of all, as you know Ruby versions prior to 1.9.3 do not compile with Apple's LLVM so we need GCC from Homebrew:

$ brew tap homebrew/dupes
$ brew install apple-gcc42

XCode 5.0 does not install header files to /usr/include anymore, instead these are distributed with XCode itself and can be pragmatically be detected with the new --show-sdk-path flag in xcrun.

Having said that we need to set some environment variables to specify additional switches to be passed to the compiler in the process of building Ruby:

$ export CPPFLAGS="-I$(xcrun --show-sdk-path)/usr/include"
$ export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include -L$(xcrun --show-sdk-path)/usr/lib"

Time to install ruby:

$ rbenv install ree-1.8.7-2011.12

This should do the trick, Rbenv will compile Ruby and install Rubygems. You can verify if the install was successful by querying your installed versions of rubies:

$ rbenv versions
Say Thanks

2 Responses
Add your response


Thanks for this! It worked beautifully for me via ruby-build and 1.9.1-p430.

over 1 year ago ·

if you already have the env set up and are having problems installing new gems:
xcode-select --install
and click 'install'

over 1 year ago ·