Skip to content

cjohansen.no

Ruby version manager, Ubuntu and openssl

RVM (Ruby Version Manager) is a hot tool which makes switching between Rubys (1.8.6, 1.8.7, 1.9.1, JRuby, you name it) as simple as `rvm use 1.9.1`. However, on Ubuntu, you may hit trouble when using the openssl package for any non-system provided Ruby version.

Fixing openssl for Rvm-provided Ruby's

On Ubuntu, apt is most commonly used to administrate Ruby. Using apt, openssl is a separate package ( libopenssl-ruby). This installs openssl for your apt-provided Ruby, which will most likely be /usr/lib/ruby/1.8/openssl. Rvm-provided Ruby's can't access this, however, so you need to build openssl for each rvm-provided Ruby you install.

The trick for this is to get the libssl-dev from apt before building openssl, otherwise you'll have trouble configuring it. So, to get openssl on a rvm-provided Ruby, simply do:

sudo apt-get install libssl-dev
cd ~/.rvm/src/ruby-1.8.7/ext/openssl
ruby extconf.rb
make && make install

Voila!

Update: readline

Trying to fire up `script/console` from a rvm-provided Ruby I hit a similar problem with the readline library. It can be fixed in much the same way:

sudo apt-get install libreadline5-dev
cd ~/.rvm/src/ruby-1.8.7/ext/readline
ruby extconf.rb
make && make install

Once again, voila!

Possibly related

2006 - 2013 Christian Johansen Creative Commons License