Last Updated: February 25, 2016
·
496
· mniyonkuru

Painful Ruby 2.0 install on OSX

Another ruby release, another breakage. Ruby installation procedures are still as magical and murder inducing as 2 years ago.

Installing ruby via rvm will sometimes halt on errors about missing libraries, commons ones like openssl, json, libxml etc..

Here's what I do to solve these errors:

  • use brew to install dependencies. Find a list of brew formulas that may have that library. At the time of writing json was json-c and libxml was libxml2 for example.

> brew install openssl json-c libxml2

  • set ruby compile options (magic):

> RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-json-dir=`brew --prefix json-c` --with-xml-dir=`brew --prefix libxml2`"

  • use rvm to reinstall:

> rvm reinstall 2.0.0 --autolibs=4

Here's to hoping that some day, someone, somewhere will be using a one-click solution instead of this.