Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install ruby on rails from scratch on Ubuntu 12.10. Getting help from this post:

echo "[[ -s '${HOME}/.rvm/scripts/rvm' ]] && source '${HOME}/.rvm/scripts/rvm'" >> ~/.bashrc
echo "[[ -s '${HOME}/.rvm/scripts/rvm' ]] && source '${HOME}/.rvm/scripts/rvm'" >> ~/.zshrc

curl -L | bash -s stable

# Then run this in order to make rvm work:
source /home/adige/.rvm/scripts/rvm

# And installed zlib, before ruby:
rvm pkg install zlib

# Last step, installed ruby:
rvm install 1.9.3 --with-zlib-dir=/home/adige/.rvm/usr

But the problem is when i try to install gems i get this error:

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

I already have these:

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

So what may be the problem?

share|improve this question
up vote 0 down vote accepted

In case of anyone's interested, i removed RVMand compiled Ruby from source code, as the official page recommends, then installed rails gem by:

sudo gem install rails

Using sudo is essential.

share|improve this answer

I had a similar issue and running the following helped me:

rvm pkg install zlib


rvm use --default <your_ruby_version>

Also make sure that your terminal is set to run as a login shell by going to:

edit->profile preferences->title and command

and ticking the 'run command as login shell' box.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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