Wednesday, April 22, 2009

How to fix "no such file to load -- openssl" error with Ruby 1.9

If you get an error like this:

/usr/local/lib/ruby/1.9.1/net/https.rb:102:in `require': no such file to load -- openssl (LoadError)

while trying to install a gem or something similar, try this:

  • sudo apt-get install libopenssl-ruby1.9
  • sudo apt-get install libssl-dev
  • cd ~/Downloads/ruby-1.9.1-p0/ext/openssl (assuming you extracted the ruby tar to ~/Downloads)
  • ruby extconf.rb && make && sudo make install

Lame, but works.