2

I've installed rbenv and downloaded a ruby using ruby-build, e.g.

rbenv global 1.9.3-p448
gem env # This show my customized ruby gem paths instead the system one, 
        # so it works!

Then I install bundler,

# gem install --no-ri --no-rdoc bundler

ERROR:  Loading command: install (LoadError)

    cannot load such file -- zlib

ERROR:  While executing gem ... (NameError)

    uninitialized constant Gem::Commands::InstallCommand

If I don't use rbenv and use my system ruby, I can install bundler. but how to install when I am using rbenv?

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
Ryan
  • 10,041
  • 27
  • 91
  • 156

3 Answers3

3

Maybe related to this similar question with RVM

Try installing zlib first :

APT :

sudo apt-get install zlib1g-dev

YUM :

sudo yum install zlib-devel

Then reinstall ruby

Community
  • 1
  • 1
Intrepidd
  • 19,772
  • 6
  • 55
  • 63
0

I had a same problem when I was using lodash-rails with Rails,

This is an usual problem when you have standalone ruby along with rbenv OR RVM OR any version managers , Its always good and stable to remove all ruby installations in your system and use only rbenv OR RVM as your ruby platform .

People use rbenv or RVM so that they can switch between any ruby version as per the requirement .

Possible reason for your problem : -

I think bundler is trying to install some dependency and that particular dependency is referring to system env path which set in your

.bashrc     OR 
.bash_profile     OR 
.profile file 

normally bundler checks for gem path which might have been set in any of your bash profile files .

set that gem path to your .rbenv/version/versionnumber/gems folder .

in your home directory . Check in the above listed files and see if you have any ruby references , if so remove just remove them .

Aravind.HU
  • 9,194
  • 5
  • 38
  • 50
0

I have a bash script that makes ruby/rails install easy on debian/ubuntu. It also installs many dependencies that you might need.

You can find it here: https://github.com/yoones/railsondeb

If you encounter any problem, don't hesitate to let me know (an issue will do).

yoones
  • 2,394
  • 1
  • 16
  • 20