alex.zherdev
alex.zherdev

Reputation: 24164

Multiple rubygems versions

Basically what I need is to install rubygems 1.3.5 on a machine (Debian) with 1.2.0 installed and having no root access.

What I've done so far: installed rubygems into $HOME/rubygems and set up GEM_HOME + added bin to the path. So running "which gem" shows me the new binary, not the old one. Also when I gem install something, it installs correctly into the new repository.

However, gem -v gives 1.2.0. And gem env gives the following:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.2.0
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
  - INSTALLATION DIRECTORY: /home/neutrino/rubygems/gems
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /home/neutrino/rubygems/gems/bin
  - RUBYGEMS PLATFORMS:
     - ruby
     - x86-linux
     - GEM PATHS:
     - /home/neutrino/rubygems/gems
     - /var/lib/gems/1.8
     - GEM CONFIGURATION:
       - :update_sources => true
       - :verbose => true
       - :benchmark => false
       - :backtrace => false
       - :bulk_threshold => 1000
       - "gemhome" => "/home/neutrino/rubygems/gems"
   - REMOTE SOURCES:
      - http://gems.rubyforge.org/

Any hints will be appreciated. I just can't see what I'm doing wrong.

Upvotes: 1

Views: 787

Answers (3)

the Tin Man
the Tin Man

Reputation: 160551

It sounds like you need to take a look at rvm, especially its ability to have multiple gem sets.

http://rvm.io/

http://rvm.io/gemsets/

Upvotes: 1

Phil Ross
Phil Ross

Reputation: 26100

I expect that the problem will be related to the gem command finding the 1.2.0 version of RubyGems from the system lib paths ahead of your local version.

You could try setting the RUBYLIB environment variable to the directory containing the rubygems.rb file. The contents of RUBYLIB (colon delimited directories) gets prepended to the Ruby load path at startup.

Upvotes: 1

khelll
khelll

Reputation: 23990

You need to put $HOME/rubygems/bin in your PATH environment before /usr/bin/. If that's not doable I would rename $HOME/rubygems/bin/gem to $HOME/rubygems/bin/my_gem and do my_gem -v and continue using it that way(my_gem)

Upvotes: 0

Related Questions