Installing openssl in ruby / rbenv

Kowshik picture Kowshik · Jun 20, 2012 · Viewed 46.2k times · Source

I need to use openssl in ruby. How should I install the same? I've installed ruby through rbenv, and am using ubuntu 12.04.

kprakasam@ubuntu:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

kprakasam@ubuntu:~$ irb
irb(main):001:0> require 'openssl'
LoadError: no such file to load -- openssl
    from /home/kprakasam/.rbenv/versions/1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/kprakasam/.rbenv/versions/1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from (irb):1
    from /home/kprakasam/.rbenv/versions/1.9.2-p180/bin/irb:12:in `<main>'

Answer

s.m. picture s.m. · Jun 20, 2012

openssl needs to be installed on your local machine.

You then need to compile Ruby with openssl support, which is achieved via the --with-openssl-dir command-line switch.

Maybe this will help you.