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>'
Rbenv is a command line tool that lets you switch between installed versions of Ruby. It can also install new versions of Ruby using the ruby-build plugin.
To install and use a different version of Ruby, run the rbenv commands with a different version number, such as rbenv install 2.3. 0 and rbenv global 2.3. 0 . You now have one version of Ruby installed and have set your default Ruby version.
rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments. Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems.
One of those is the ruby-build project, which also provides an optional plugin for Rbenv that provides an rbenv install subcommand. This plugin will typically install Ruby implementations in ~/. rbenv/versions/* , but that is configurable.
For Mac OSX this is what saved me:
RUBY_CONFIGURE_OPTS=--with-openssl-dir=<openssl install dir> rbenv install
From the Ruby build wiki
But.. how to find the openssl install dir?:
$ brew list openssl /usr/local/Cellar/openssl/1.0.2d_1/bin/c_rehash /usr/local/Cellar/openssl/1.0.2d_1/bin/openssl ...
Then the openssl install dir is:
/usr/local/Cellar/openssl/1.0.2d_1/
And the ruby installation command ends as this:
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2d_1/ rbenv install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With