I have a problem with rubygems on a OS X 10.4.10 Tiger PPC. Ruby 1.8.6
and rubygems 0.9.4 are installed properly. Ruby is installed through
fink so I set PREFIX to /sw. I installed rubygems by
PREFIX=/sw
export GEM_HOME=$PREFIX/lib/ruby/gems/1.8
export RUBYLIB=$PREFIX/lib/ruby:$PREFIX/lib/site_ruby/1.8
sudo ruby setup.rb all --prefix=$PREFIX
so it should be aware of the repository path. I installed some gems, the
gem list command shows them as expected.
I have -rubygems in RUBYOPT.
But when I simply require any gem by name, I get a LoadError (on the
file, not rubygems itself). If I specify the absolute path of the gem's
main file to require, it passes without error.
Replying to myself: it turned out that I was using the wrong way to
check if I can require the given gem, and actually rubygems works just
fine. This transformed my problem into another question. What's the
difference between the following two cases?
$ ruby -rsome-gem -e 'puts "ok"'
ruby: no such file to load -- some-gem (LoadError)
$ ruby -e 'require "some-gem"; puts "ok"'
ok
$
mortee wrote:
···
Hi,
I have a problem with rubygems on a OS X 10.4.10 Tiger PPC. Ruby 1.8.6
and rubygems 0.9.4 are installed properly. Ruby is installed through
fink so I set PREFIX to /sw. I installed rubygems by
PREFIX=/sw
export GEM_HOME=$PREFIX/lib/ruby/gems/1.8
export RUBYLIB=$PREFIX/lib/ruby:$PREFIX/lib/site_ruby/1.8
sudo ruby setup.rb all --prefix=$PREFIX
so it should be aware of the repository path. I installed some gems, the
gem list command shows them as expected.
I have -rubygems in RUBYOPT.
But when I simply require any gem by name, I get a LoadError (on the
file, not rubygems itself). If I specify the absolute path of the gem's
main file to require, it passes without error.
Replying to myself: it turned out that I was using the wrong way to
check if I can require the given gem, and actually rubygems works just
fine. This transformed my problem into another question. What's the
difference between the following two cases?
$ ruby -rsome-gem -e 'puts "ok"'
ruby: no such file to load -- some-gem (LoadError)
$ ruby -e 'require "some-gem"; puts "ok"'
ok
$
mortee wrote:
Hi,
I have a problem with rubygems on a OS X 10.4.10 Tiger PPC. Ruby 1.8.6
and rubygems 0.9.4 are installed properly. Ruby is installed through
fink so I set PREFIX to /sw. I installed rubygems by
PREFIX=/sw
export GEM_HOME=$PREFIX/lib/ruby/gems/1.8
export RUBYLIB=$PREFIX/lib/ruby:$PREFIX/lib/site_ruby/1.8
sudo ruby setup.rb all --prefix=$PREFIX
so it should be aware of the repository path. I installed some gems, the
gem list command shows them as expected.
I have -rubygems in RUBYOPT.
But when I simply require any gem by name, I get a LoadError (on the
file, not rubygems itself). If I specify the absolute path of the gem's
main file to require, it passes without error.
What may be wrong with my setup?
thx
mortee
Before you can require a gem, you must require RubyGems. This occurs automatically for you because you have -rubygems in RUBYOPT. However, when you using the -r option to require a file, Ruby doesn't automatically require RubyGems, so Ruby can't find the thing you want to require. The only kind of libraries you can require with the -r option are libraries that aren't gems.
I'm pretty sure this limitation will be removed in the next release of Ruby.