irb(main):001:0> require ‘rubygems’
irb(main):002:0> require ‘builder’
All well and good. Now:
$ cat > foo.rb
$ chmod +x foo.rb
require__': no such file to load -- builder (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
What’s going on here? I only experience this with builder. Other
modules seem fine. Incidentally, there’s a builder.rb at
right next to the custom_require.rb that fails to find it.
Thanks for any insights!
I guessed that maybe the fact that I was using /usr/bin/ruby and there
was a separate /usr/local/bin/ruby might be a problem. They are the
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]
and in fact, one turns out to be a symlink to the other(!) but using
/usr/bin/ruby in the shebang fails, while using /usr/local/bin/ruby in
the shebang succeeds.
Gregory M. wrote:
Print the value of $: to determine the directories in which Ruby will
look for libraries. Those directories are largely determined by the
directory in which Ruby is installed at the time Ruby is installed. If
Ruby is actually installed in /usr/local then it won’t search for
libraries in /usr.