cannot load such file -- zlib even after using rvm pkg install zlib cannot load such file -- zlib even after using rvm pkg install zlib ruby ruby

cannot load such file -- zlib even after using rvm pkg install zlib


I ended up installing zlib from apt-get and then reinstalling ruby to not use the rvm directory for zlib.

Here's how do:

$ sudo apt-get install zlib1g-dev$ rvm reinstall 1.9.3

[Edit] As commenter @chrisfinne mentions, on CentOS/RedHat based systems:

$ sudo yum install zlib-devel$ rvm reinstall 1.9.3


The both other responses were almost right...

The rvm site for zlib provides a quick fix!

On the top off the page is a "Quick fix" follow it's instructions, it will:

  • fix your installation,
  • provide you instructions what to do to install zlib from your system
  • and show how to reinstall ruby


Use autolibs to install dependencies:

rvm autolibs enablervm reinstall 1.9.3

RVM will automatically install missing dependencies and use them for compiling ruby.

More details on autolibs => http://rvm.io/rvm/autolibs