On Ubuntu 12.04 trying to install Rails with $ gem install Rails fails with ERROR: Loading command: install (LoadError) cannot load such file -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand Ruby was installed with rbenv. More info: ~$ gem environment RubyGems Environment: - RUBYGEMS VERSION: 1.8.23 - RUBY VERSION: 1.9.3 (2012-10-12 patchlevel 286) [i686-linux] - INSTALLATION DIRECTORY: /home/user/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: /home/user/.rbenv/versions/1.9.3-p286/bin/ruby - EXECUTABLE DIRECTORY: /home/user/.rbenv/versions/1.9.3-p286/bin - RUBYGEMS PLATFORMS: - ruby - x86-linux - GEM PATHS: - /home/user/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1 - /home/user/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ and ~$ lsb_release -a;uname -a; dpkg -l|grep zlib LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch Distributor ID: Ubuntu Description: Ubuntu 12.04.1 LTS Release: 12.04 Codename: precise Linux machine 3.2.0-32-generic-pae #51-Ubuntu SMP Wed Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux ii zlib1g 1:184.108.40.206.dfsg-3ubuntu4 compression library - runtime ii zlib1g-dev 1:220.127.116.11.dfsg-3ubuntu4 compression library - development What is wrong?
on 2012-11-10 16:25
on 2012-11-10 17:01
Pardon the silly question, but are you sure zlib1g-dev was installed prior to building this ruby and not after the fact? (This has caused many the annoying hour for me with multiple rubies and forgetting when ruby x was actually built!)
on 2012-11-10 22:54
No, the question is not silly at all. Actually, when I presented this problem in an Ubuntu forum I asked it myself. And, yes, uninstalling and reinstalling ruby 1.9.3-p286 solved the problem. Thank you very much! Den lrdagen den 10:e november 2012 kl. 17:00:21 UTC+1 skrev Sam Pizzey: