Skip to content

Ruby on Rails with RVM on Ubuntu: no such file to load — openssl error

January 30, 2011

The following was adapted from: http://cjohansen.no/en/ruby/ruby_version_manager_ubuntu_and_openssl

RVM (Ruby Version Manager) is a must if you are working with different versions of Ruby. You can also create “gemsets” which are a set of gems that you can easily switch between. It isn’t perfect, however, on Ubuntu, you may hit some errors when using 1.8.7 when trying to use the openssl package for any non-system provided Ruby version.

Fixing openssl for Rvm-provided Ruby’s

RVM maintains the various versions of ruby in their own self-contained environments (folders) and will have trouble accessing some system-installed packages. 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
Advertisements

From → Web Development

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: