Error: cannot load such file — zlib

When i try to install rails in Ubuntu 12.10 i get this error:

$ gem install rails ERROR: Loading command: install (LoadError) cannot load such file -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand

So i completely removed rvm:

rvm implode sudo rm -rf ~/.rvmremoved the script calls in my .bashrc and
.bash_profile

and checked if they’re really removed:

env | grep rvm #no output, so rvm is removed ruby -v #The program 'ruby' can be found in the following packages: blabla

I already have these via sudo apt-get install:

curl zlib1g-dev zlib1g libssl-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

Then proceed to install from scratch

curl -L https://get.rvm.io | bash -s stable --ruby --auto-dotfiles

then run that line and restarted terminal regard to this message:

* To start using RVM you need to run `source /home/adige/.rvm/scripts/rvm` in all your open shell windows, in rare cases you need to reopen all shell windows.

Then

rvm pkg install readline

but completed with error:

[CODE]…
Error running ‘autoreconf -is --force’, please read
/home/adige/.rvm/log/readline/autoreconf.log

Please note that it’s required to reinstall all rubies:

    rvm reinstall all --force[/CODE]

I think it’s installed anyway, right? Before reinstall all rubies, i
installed zlib of course:

# w/out verify, it gives checksum error rvm pkg install zlib --verify-downloads 1

Then run

rvm reinstall all --force

and completed with error again:

... Install of ruby-1.9.3-p374 - #complete Making gemset ruby-1.9.3-p374 pristine. Error running '' under , please read /home/adige/.rvm/log/ruby-1.9.3-p374/gemset.pristine.log Making gemset ruby-1.9.3-p374@global pristine.

gemset.pristine.log: [2013-02-06 14:19:04] rvm gemset pristine # under ruby-1.9.3-p374Restoring gem - Pastebin.com

Then reinstall ruby with zlib support:

rvm reinstall 1.9.3-p374 --with-zlib-dir=$rvm_path/usr

which returned same error and same log([2013-02-06 14:19:04] rvm gemset pristine # under ruby-1.9.3-p374Restoring gem - Pastebin.com) but
completed anyway.

Finally i tried to install rails gem again but

cannot load such file -- zlib !

Here is the rvm info: ruby-1.9.3-p374: system: uname: "Linux adige-LG 3.5.0-23-generic - Pastebin.com

What am i doing wrong?

Thanks but didn’t work.

restart machine…

On Wed, Feb 6, 2013 at 7:50 AM, Efe A. [email protected] wrote:

When i try to install rails in Ubuntu 12.10 i get this error:

$ gem install rails ERROR: Loading command: install (LoadError) cannot load such file -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand

Did you run rvm requirements? I know I recently had the same
trouble, and the requirements list led me to install the right Ubuntu
packages. I don’t recall offhand if it only required zlib1g-dev and
zlib1g, or if something else was required; but I didn’t have to use
rvm pkg at all once I had the debs installed.

Here’s the output. But i already done these. Still no luck.

Requirements for ubuntu/12.10/i386

NOTE: ‘ruby’ represents Matz’s Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the original / standard Ruby Language Interpreter
‘ree’ represents Ruby Enterprise Edition
‘rbx’ represents Rubinius

Additional Dependencies:

For update-system:

sudo apt-get update

For rvm:

sudo apt-get --no-install-recommends install bash curl git patch bzip2

For ruby:

sudo apt-get --no-install-recommends install build-essential openssl
libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev
libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf
libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion
pkg-config libffi-dev

For jruby:

sudo apt-get --no-install-recommends install curl g++
openjdk-6-jre-headless