# Ruby can't find installed gems

**URL:** <https://www.ruby-forum.com/t/ruby-cant-find-installed-gems/102166>\
**Category:** Ruby\
**Created:** [August 12, 2006, 12:42am UTC](https://www.ruby-forum.com/t/ruby-cant-find-installed-gems/102166 "2006-08-12T00:42:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9dc877/32.png) [@chet](https://www.ruby-forum.com/u/chet)\
**Post date:** [August 12, 2006, 12:42am UTC](https://www.ruby-forum.com/t/ruby-cant-find-installed-gems/102166/1 "2006-08-12T00:42:33Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![chet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9dc877/32.png) [@chet](https://www.ruby-forum.com/u/chet)\
**Post date:** [August 12, 2006, 12:48am UTC](https://www.ruby-forum.com/t/ruby-cant-find-installed-gems/102166/2 "2006-08-12T00:48:53Z")

</div>

Chet F. 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

# It might be missing this if these are through Gems

require ‘rubygems’

> 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)
> 
> \</snip for RForum\>
> 
> Help!
> 
> Thanks in advance…

---

<div class="post-metadata">

**Author:** ![chet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9dc877/32.png) [@chet](https://www.ruby-forum.com/u/chet)\
**Post date:** [August 12, 2006, 2:24am UTC](https://www.ruby-forum.com/t/ruby-cant-find-installed-gems/102166/3 "2006-08-12T02:24:33Z")

</div>

Eero S. wrote:

> Chet F. 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
> 
> # It might be missing this if these are through Gems
> 
> require ‘rubygems’

That does appear to be at least part of my “something stupid n00b error”  
issue. By doing that, my error goes away and all is well on OS X, but  
I’ve still sustained brokenness on Ubuntu. Now it’s complaining of  
openssl issues, but I suspect my endless recompilations of ruby today  
have left the machine somewhat confused. I’ll reboot and reimage it  
tomorrow and start from there now that I know a bit more.

Thanks for the quick reply. Best,

chet  
Houston

---

<div class="post-metadata">

**Author:** ![chet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9dc877/32.png) [@chet](https://www.ruby-forum.com/u/chet)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/ruby-cant-find-installed-gems/102166/4 "2006-08-15T14:17:29Z")

</div>

Chet F. wrote:

> require ‘net/sftp’  
> hand-compiled 1.8.4 based on a thread from earlier this month. Since I’m
> 
> 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).

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

You can skip the LightTPD if you like - the section on installing Ruby  
and Rails on Tiger is excellent on its’ own.

Good luck!
