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

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

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

Tags:

Linux

Ruby

Gem

Rvm