Ubuntu 11.04 RVM Gem Problem
I recently encountered this issue when using Ubuntu 11.04 to set up a new Rails server with RVM, Passenger, Apache. The first indication of a problem is when you see this line at the end of the rvm install 1.9.2 output:
ruby-1.9.2-p180 - #importing default gemsets (/home/user/.rvm/gemsets/) 'gem' command not found, cannot select a gemset. Install of ruby-1.9.2-p180 - #complete
This means it had issues compiling ruby, rubygems in particular. You will also notice this error when using the gem command to install any gems:
ERROR: Loading command: install (LoadError) no such file to load -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand
To fix this you’ll have to install the zlib libraries with the command:
sudo apt-get install libghc6-zlib-dev
This won’t fix the problem immediately, you’ll have to rebuild ruby by using:
rvm install 1.9.2
Then you’ll be able to properly install any gems you require.