views:

218

answers:

3

Hi guys,

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.

A: 

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)

khelll
already done that. /usr/bin is in the end, and the proper executable is found. As I see it, the problem is in rubygems itself, not in path settings..
neutrino
Did u reopen the terminal after modifying the path? Tried renaming?
khelll
yep, reopened. Renaming also doesn't help, and I don't know how this could give any result. The thing is, I run the executable from the installed 1.3.5, and it says it's 1.2.0.
neutrino
Opps, didn't note that. Yea seems a weird specially that all gems are installed correctly. However I would recommend a last thing, do : gem update --system.
khelll
thanks for bearing with me, but gem update --system is disabled on Debian :)
neutrino
How come you can do gem install and you can't do gem update, specially that you are running your local version.
khelll
it's a special case for Debian, it doesn't matter whether the installation is local or global. If I'm not mistaken they did it so because of some conflicts with apt-get.
neutrino
A: 

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.

Phil Ross
+1  A: 

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

http://rvm.beginrescueend.com/

http://rvm.beginrescueend.com/gemsets/

Greg