Installing Ruby 2.0 on Mountain Lion

April 30, 2013 at 17:16:50

I was able to install Ruby 2.0 on Mountain Lion (Mac OS X 10.8.3) very easily, but I’m afraid I didn’t actually learn anything in the process.

The problem is that there is something wrong with Mountain Lion’s OpenSSL installation. This bites you when you try to use the gem command. Working around the problem when compiling Ruby 2.0 is very tricky — so tricky that I wasn’t able to figure out how to do it.

So I cheated: I let ruby-build do it for me.

I’m already using rbenv to switch among ruby versions, so installing ruby-build into it as a plug-in is a no-brainer and a one-liner:

$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

After that, you just say this:

$ rbenv install 2.0.0-p0

ruby-build takes care of downloading and building a new version of OpenSSL (which I had already done) and of building ruby while pointing at that new version (which I had tried to do but somehow failed). The result is a working ruby 2.0. I’m afraid I didn’t turn on verbose logging so I don’t what ruby-build actually did, but it is evidently smarter than I am.

Home

This page prepared February 14, 2014 by Matt Neuburg, phd = matt at tidbits dot com, using RubyFrontier. RubyFrontier is a port, written in the Ruby language, of the Web-site-creation features of UserLand Frontier. Works just like Frontier, but written in Ruby!
Download RubyFrontier from GitHub.