Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing openssl in ruby / rbenv

Tags:

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>' 
like image 709
Kowshik Avatar asked Jun 20 '12 18:06

Kowshik


People also ask

Does Rbenv install Ruby?

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.

How do I install a specific version of Ruby using Rbenv?

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.

What is Rbenv in Ruby?

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.

Where is Ruby installed with Rbenv?

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.


1 Answers

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 
like image 172
fguillen Avatar answered Sep 19 '22 17:09

fguillen