Wednesday, March 6, 2013

20th anniversary of Ruby, version 2.0 is out!

Ten days ago or so, the first stable release of ruby 2.0 was shipped, so I decided to give it a try. Since I had to do a few things to get it working, I list them all below as a cheat sheet for myself, or others as well...

First of all, I should mention that I run OSX 10.8 Mountain Lion.That said, let's see.

Get the latest version of RVM and check if I am missing any required package:

 $ rvm get stable  
 $ rvm requirements  

In my case, openssl is what I needed to install, but other scenarios might be different.

 $ rvm pkg install openssl  

Then, when I tried to install a gem, i got an error like the following:

 ERROR: Loading command: install (LoadError) 
 cannot load such file -- openssl

That might be because there is an incorrect reference to the openssl config file, so, let's see where it did install, and then provide the correct path

 $ find . -type f -name "openssl.cnf"  
 $ rvm install 2.0.0 --with-openssl-dir=[path_found_above] --verify-downloads 1

After that, everything went fine.
In order to check all ruby installations your system has, you can run:

 $ rvm list  

Version 2.0.0-p0 should be there, and if you want to make your default, do:

 $ rvm --default use 2.0.0  

Even though you make any given ruby version the system's default, I humbly suggest creating gemsets per directory, with its own version of ruby and gems. For further reading about gemsets, check this out.