From: "Steven R." Date: 2006-08-12T08:00:06+09:00 Subject: Re: Ruby can't find installed gems Chet Farmer wrote: > I've been fighting this all day, and I can't grok where I've gone wrong. > I hope someone here can help. > > I'm trying to write a fairly simple script to handle some periodic SFTP > file submissions to a client's vendor. Net::SFTP seems like just the > ticket! > > My code, then, has > > require 'net/ssh' > require 'net/sftp' > > in it, but every attempt to run gets this: > > $ /usr/bin/ruby xm.rb > xm.rb:21:in `require': no such file to load -- net/ssh (LoadError) > > I've tried this with the out-of-the-box ruby install (1.8.3) on my > PowerBook (Tiger); a customized install I found instructions for on the > Rails site on the grounds that the OS X ruby is "broken"; and on my > Ubuntu box. On Ubuntu, I tried with the packaged 1.8.3 as well as a > hand-compiled 1.8.4 based on a thread from earlier this month. Since I'm > having essentially the same problem on two different platforms, it's > clearly something silly I've done, but I don't know what. (Oh, and irb > fails the same way on the require lines.) > > I'm new to ruby, obviously, and quite keen to get started, but I really > don't know where to go next. I don't even know how to properly > interrogate ruby about its environment (sort of a ruby equivalent of > "perl -V"). > > Help! > > Thanks in advance... > First, try this: prompt$ irb -rrbconfig irb(main):002:0> Config::CONFIG["gems"] irb(main):003:0> Config::CONFIG["site_ruby"] If you get 'nil' you probably have an issue with your install - the gems are there, but the required system variables are not set, or your PATH is incomplete. You can include the entire path in your require line, but that is an inelegant solution - but it will work if you are at the hair-pulling stage and are waiting for a more advanced user to help. Obviously, I am still getting my installation up and running too - but the above solution worked for me 'for the time being'. In case you haven't seen this before - here's an amazing resource for your setup (based on your description). http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger You can skip the LightTPD if you like - the section on installing Ruby and Rails on Tiger is excellent on its' own. Good luck!