attilagyorffy.com

Installing Ruby on OS X 10.9 Mavericks using rbenv

Introduction

Attila Györffy

Attila Györffy

I'm a Ruby/JS dev/trainer with a focus on quality. An ex-Londoner, @terracycle, @ubxd, @lastfm. Follow me at http://twitter.com/attilagyorffy


rbenv os x mavericks os x 10.9

Installing Ruby on OS X 10.9 Mavericks using rbenv

Posted by Attila Györffy on .
Featured

rbenv os x mavericks os x 10.9

Installing Ruby on OS X 10.9 Mavericks using rbenv

Posted by Attila Györffy on .

Even though Ruby comes preinstalled on OS X Mavericks, I do like to manage my Rubies with rbenv, so I decided to duplicate Ruby 2.0.0-p195 on my system. You might be shaking your head now: Yes, OS X comes with Ruby version 2.0.0-p195 preinstalled (as opposed to the old 1.8.7 that was shipping with previous versions of OS X)

So, what you will most likely need are the following:

  • Need to make sure that you have the Command Line Tools installed (I did not have XCode 5 installed at this time)
  • You will need to instruct rbenv to configure Ruby without the Tcl/Tk bindings

First of all after installing the Command Line Tools, you should make sure that your system is set up correctly to make use of them:

$ xcode-select -p
/Library/Developer/CommandLineTools

If this points to a subdirectory in XCode.app instead, you most likely have had Xcode installed already. I prefer using the Command Line Tools without the full Xcode package because it's easier to maintain and uses a lot less disk space.

In case you want to remove Xcode and use the CLT exclusively, you can reset the development tool settings by using xcode-select:

$ sudo xcode-select --reset

NOTE: I decided to uninstall apple-gcc42 from Homebrew as I'd like to depend on Apple's new LLVM exclusively. Ruby should build with LLVM nicely since version 1.9.3 anyway. As a reference, my gcc looks like this:

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.1.61) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

Right, now that we have the command line tools installed nicely it's time to build Rubies. As I've mentioned before in order to build Ruby on Mavericks, you would have to pass down configuration options. Rbenv uses theCONFIGURE_OPTS environment variable for this:

CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --without-tcl --without-tk" rbenv install 2.0.0-p195

The command above should run successfully on a Mavericks install.

Attila Györffy

Attila Györffy

https://attilagyorffy.com

I'm a Ruby/JS dev/trainer with a focus on quality. An ex-Londoner, @terracycle, @ubxd, @lastfm. Follow me at http://twitter.com/attilagyorffy

View Comments...