Search code examples
ruby-on-railsrubyrubygemszlibubuntu-8.10

Ubuntu rails install fails on zlib


I've just moved over to Ubuntu 8.10 as my dev box; it's my first serious foray into Linux as a daily-use OS, and I'm having a hard time getting Rails going. I have followed a number of tutorials which all seem to work fine, but when I try and use gem install or gem update on anything, I get an error that looks like this:

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
from /usr/local/bin/gem:21

I have (as recommended in the tutorials) installed zlib, zlib1g, and zlib1g-dev. I've even found a few tutorials on this particular problem (all for flavors other than mine, however) but they didn't help.

I'm on Ubuntu 8.10, ruby version 1.8.8dev gem version 1.3.2

I've tried reinstalling ruby and gems each and separately, to no avail.


Solution

  • If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/

    The steps are:

    rvm pkg install zlib
    

    (or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)

    then

    rvm remove 1.9.1
    rvm install 1.9.1