tags:

views:

153

answers:

4

I manually placed a library in the library directory (/usr/local/lib/ruby/site_ruby/1.8) and when I try to require it, it says "no such file to load".

I used "$:.first" to get the library path, so why wont it work? Is there any good way to debug this?

Thanks

A: 

A couple of shots in the dark:

  • are you using lower case in your require statements? If you're on a unix system, case matters.

  • did you try restarting your terminal?

Drew Johnson
The case is correct and I restarted the terminal. Thanks for your input.
Jeremy Gillick
A: 

Another shot in the dark... Is the file readable (i.e. the current user has read access)? Ruby gives the same error message if a file does not exist or if it is not readable.

Marc-André Lafortune
A: 

Joining in with the stabbing in the dark… :)

Did you put a directory or a .rb-file in the load path? If you put a directory, did you try to load a file in the directory?

A lot of libraries put all their files in a directory of their own, but also give you a single .rb in the "root" of the path with the same name as the directory. That file in turn load all files needed in the directory.

ba
A: 

I think I figured out the problem. The library (fsevents) was calling "osx/foundation" and the machine that had the problem didn't have RubyCocoa installed. After I installed RubyCocoa it worked perfectly. It's just strange that it said that it couldn't find fsevents.rb when the problem was actually with osx/foundation.

And to answer your questions, the value of $: for me is: "=> ["/opt/local/lib/ruby/site_ruby/1.8", "/opt/local/lib/ruby/site_ruby/1.8/i686-darwin9", "/opt/local/lib/ruby/site_ruby", "/opt/local/lib/ruby/vendor_ruby/1.8", "/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin9", "/opt/local/lib/ruby/vendor_ruby", "/opt/local/lib/ruby/1.8", "/opt/local/lib/ruby/1.8/i686-darwin9", "."]"

Jeremy Gillick