"Chris Morris" <chrismo / homemail.com> writes: > Newbie alert: ruby can't find the file I'm referring to in a require > statement. The file required is in the same directory as the original source > file. Obviously, this doesn't work. Where does ruby get its path info? The default path to search is set when Ruby is installed, and includes all the standard Ruby directories, along with the current directory. You can get a list by printing out the $: array: puts $: => /tc/usr/lib/ruby/site_ruby/1.6/i686-linux /tc/usr/lib/ruby/site_ruby/1.6 /tc/usr/lib/ruby/site_ruby /tc/usr/lib/ruby/1.6/i686-linux /tc/usr/lib/ruby/1.6 . You can modify this at runtime using the -I option, and the RUBYLIB environment variable: RUBYLIB=wombat:koala ruby -Iwallaby -e 'puts $:' => wallaby wombat koala /tc/usr/lib/ruby/site_ruby/1.6/i686-linux /tc/usr/lib/ruby/site_ruby/1.6 /tc/usr/lib/ruby/site_ruby /tc/usr/lib/ruby/1.6/i686-linux /tc/usr/lib/ruby/1.6 . However, if you run a script out of a directory that isn't your current working directory, and that script tries to require a file in its own directory, it won't find it unless that directory also happens to be in the path. dave[~ 22:45:42] cd tmp dave[~/tmp 22:47:01] cat >a.rb require 'b.rb' dave[~/tmp 22:47:09] cat >b.rb puts "hello" dave[~/tmp 22:47:41] ruby a.rb hello dave[~/tmp 22:47:43] cd .. dave[~ 22:47:44] ruby tmp/a.rb tmp/a.rb:1:in `require': No such file to load -- b.rb (LoadError) from tmp/a.rb:1 dave[~ 22:47:48] Regards Dave