From: Michael Glaesemann Date: 2006-11-12T23:28:30+09:00 Subject: gem query finds gem, yet require fails I'm setting up a secondary machine to run tests. I've run into a problem with gems not being found. Everything works fine on my primary machine, and I haven't been able to tease out what the difference is in the two setups. I've installed Ruby 1.8.5 and rubygems 0.9.0, both from source, on Mac OS X 10.4.8. Ruby configuraiton: $ ./configure --prefix=/usr/local rubygems installation: $ sudo /usr/local/bin/ruby setup.rb I installed the PostgreSQL bindings gem using: $ sudo gem install postgres The bindings appeared to install correctly. Using gem query, I can see: *** LOCAL GEMS *** postgres (0.7.1) The extension library to access a PostgreSQL database from Ruby. sources (0.0.1) This package provides download sources for remote gem installation However, when testing with irb to see if the postgres gem can be found, I get: $ which ruby /usr/local/bin/ruby $ which irb /usr/local/bin/irb $ irb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'postgres' LoadError: no such file to load -- postgres from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `gem_original_require' from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:27:in `require' from (irb):2 I'm stumped. On my primary machine, the above two commands work just fine in irb. Looking around custom_require.rb and seeing the private init_gemspecs method, I tried: irb(main):006:0> gs = Gem::GemPathSearcher.new ... irb(main):017:0> pp gs.send(:init_gemspecs) I can see the postgres gem included in the list (relevant part of the output is posted below). However, the find method fails: irb(main):018:0> gs.find('postgres') => nil The default dir appears to be correct: irb(main):020:0> Gem.default_dir => "/usr/local/lib/ruby/gems/1.8" In the shell: $ ls -la /usr/local/lib/ruby/gems/1.8 total 4040 drwxr-xr-x 7 root wheel 238 Nov 12 22:11 . drwxr-xr-x 3 root wheel 102 Nov 12 22:10 .. drwxr-xr-x 11 root wheel 374 Nov 12 22:24 cache drwxr-xr-x 10 root wheel 340 Nov 12 22:24 doc drwxr-xr-x 11 root wheel 374 Nov 12 22:24 gems -rw-r--r-- 1 root wheel 2066469 Nov 12 22:12 source_cache drwxr-xr-x 11 root wheel 374 Nov 12 22:24 specifications Any help would be appreciated. I've been staring at this for quite a while now and nothing new is coming to me. I don't have any GEM_* environmental variables or .gemrc files on either machine. Anything else I should try or check? Thanks! Michael Glaesemann grzm seespotcode net ### partial init_gemspecs output #