I have a fresh Ubuntu 12.04 VM, and I would like to install Ruby 2.0.0-p0. I am able to get Ruby installed easily enough, but I am unable to get gems to work.

$ gem install bundler
ERROR:  Loading command: install (LoadError)
cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

I have open SSL installed, so I'm not exactly sure what the problem is.

$ sudo apt-get install libssl1.0.0 libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl-dev is already the newest version.
libssl1.0.0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


$ which openssl

If I go back to the installation, there are two lines that concern me.

$ sudo make install
Failed to configure openssl. It will not be installed.
Failed to configure readline. It will not be installed.



In your source location, cd ext/openssl and then ruby extconf.rb. This will generate a makefile in the ext/openssl directory. Simply make && sudo make install it to build the ruby openssl extension, and install the .so into the appropriate location.

Ditto ext/readline for readline support.

Then you should be able to make ruby properly.

Edit: in case I wasn't clear enough:

pushd ext/openssl
ruby extconf.rb
make && sudo make install

pushd ext/readline
ruby extconf.rb
make && sudo make install

sudo make install
| improve this answer | |
  • 1
    Note: this answer is for manually building and installing Ruby and its extension modules. See @chris-d's answer for a pure apt-based answer. – Matty K Feb 24 '16 at 23:22
  • 1
    I got stuck on the third line, trying to make in ext/openssl: *** No rule to make target '/include/ruby.h', needed by 'ossl.o'. Stop. Same thing for ext/readline. – ZX9 Dec 10 '17 at 2:35
  • @ZX9 I had the same problem, the solution here worked for me. – jgon Dec 21 '19 at 21:26

I ran into the same issue, I had to install the following two packages


in fact I found I had to install the following packages to get ruby 2.0.0 and postgres 9.2 to compile on ubuntu 13.04 with openssl and readline so I thought I would share them

sudo apt-get -y update
sudo apt-get install -y make g++
sudo apt-get install -y curl git-core python-software-properties
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev
sudo apt-get install -y libgdbm-dev libreadline6-dev libncurses5-dev
sudo apt-get install -y libpq-dev libffi-dev
| improve this answer | |

for me it was a case of missing dependencies.

i thought i had all the dependencies required to install ruby, but i too was getting an openSSL and readline error.

i attempted to install ruby with RVM without root privileges which failed but gave me a list of missing dependencies. i then installed the dependencies with a package manager. i then re-attempted to install ruby from source from the beginning, and everything worked OK

the dependencies that were missing, for me, were:

patch libyaml-devel autoconf gcc-c++ readline-devel libffi-devel openssl-devel automake libtool bison sqlite-devel

but they may be different for you.

update: i don't originally remember where exactly i found this list, but a quick search found similar lists on the following pages, which might also help you:



| improve this answer | |

When installing ruby 2.0, it is possible that rubygems 2.0 installation did not complete ok, because of openssl. Make sure you provide a valid path to the openssl config file; you could:

find . -type f -name "openssl.cnf"

path is usually $HOME/.rvm/usr or $HOME/.rvm/usr/ssl


[sudo] rvm reinstall ruby-2.0.0-p0 --with-openssl-dir=[openssl.cnf path] --verify-downloads 1

Make sure rubygems installation complete successfully. Might be a better way to fix that path without reinstalling, but this should do it.

| improve this answer | |
  • 1
    I am trying an install without RVM or RBENV. Just compiling from sources. Hence the ./configure, make, and make install steps. Thank you, though. – Jarrett Meyer Mar 1 '13 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.