[Rubygems-developers] mutliple gem directories on Linux/debian

Rene Perrier raperrier at lbl.gov
Mon Aug 6 21:54:25 EDT 2007


Hi all,

I did a significant amount of googling and archive reading before 
posting to this list, but I still cannot get a working environment in 
which I have 2 gem directories.

I don't have root/sudo privileges on one of the (Linux/Debian) box I'm 
working with and I'm trying to have my own gem directory in addition to 
the one already in place on that box.

Here what I started with (GEM_HOME and GEM_PATH variables not set)

me at host:$ gem env
Rubygems Environment:
  - VERSION: 0.9.0 (0.9.0)
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - GEM PATH:
     - /usr/lib/ruby/gems/1.8
  - REMOTE SOURCES:
     - http://gems.rubyforge.org

I wanted to install an new gem (fastercsv) and I checked it was not 
installed already:
me at host:$ ruby -e "require 'fastercsv'"
-e:1:in `require': no such file to load -- fastercsv (LoadError)
        from -e:1

just for the heck of it, I also ran a "gem query | grep faster" and it 
returned nothing.

So I created my personal gem directory (mkdir ~/gems) and installed the 
fastercsv gem in it (using the -i option for gem)

me at host$  gem install fastercsv -i ~/gems
Need to update 1 gems from http://gems.rubyforge.org
.
complete
Successfully installed fastercsv-1.2.0

Then, I added my own gem directory to my GEM_PATH environment variable
me at host$ export GEM_PATH=~/gems

Then I verified that it was added

me at host$ gem env
Rubygems Environment:
  - VERSION: 0.9.0 (0.9.0)
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - GEM PATH:
     - /home/rperrier/gems
     - /usr/lib/ruby/gems/1.8
  - REMOTE SOURCES:
     - http://gems.rubyforge.org

Then I verified that the new gem could be found
me at host$ gem query | grep faster
fastercsv (1.2.0)
    FasterCSV is CSV, but faster, smaller, and cleaner.

But when I tried to use the newly installed gem in a ruby program, it 
didn't work.

I tried first:
me at host$ ruby -e "require 'fastercsv'"
-e:1:in `require': no such file to load -- fastercsv (LoadError)
        from -e:1

I tried then irb:
me at host$ irb
irb(main):001:0> require 'rake'
=> true
irb(main):002:0> require 'fastercsv'
LoadError: no such file to load -- fastercsv
        from (irb):2:in `require'
        from (irb):2

I tried with different values of GEM_PATH 
("~/gems:/usr/lib/ruby/gems/1.8". "/usr/lib/ruby/gems/1.8:~/gems"), but 
it was still not working.

So am I missing something?

The worse is that I tried to do the same on a windows box and it worked...

Any help / hint / suggestion would be greatly appreciated.

Thanks


-- 
René 



More information about the Rubygems-developers mailing list