# Ruby load path and gems

**URL:** <https://rubytalk.org/t/ruby-load-path-and-gems/36374>\
**Category:** ruby-talk\
**Created:** [22 March 2007 22:55 UTC](https://rubytalk.org/t/ruby-load-path-and-gems/36374 "2007-03-22T22:55:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_V](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mark\_V](https://rubytalk.org/u/Mark_V)\
**Post date:** [22 March 2007 22:55 UTC](https://rubytalk.org/t/ruby-load-path-and-gems/36374/1 "2007-03-22T22:55:04Z")

</div>

Hi,  
I'm a relative newbie to ruby and linux, so please excuse this if it  
seems a little naive. Also please accept thanks for all the work that  
has gone into a great language.

I thought that if '/usr/lib/ruby/1.8' was in the ruby load path "$:",  
then ruby would search for a 'require'd package in subdirectories  
under that directory?

for example (as root):  
#gem install 'fastercsv' --install-dir='/usr/lib/ruby/1.8'

This installs without error and fastercsv.rb seems to be where it  
should:  
/usr/lib/ruby/1.8/gems/fastercsv-1.2.0/lib

now (still with root and the same shell session):  
mv-laptop:/usr/lib/ruby/1.8 # irb  
irb(main):001:0\> require 'fastercsv'  
LoadError: no such file to load -- fastercsv  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1:in `require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1  
irb(main):002:0\> puts $:  
/usr/lib/ruby/site\_ruby/1.8  
/usr/lib/ruby/site\_ruby/1.8/i586-linux  
/usr/lib/ruby/site\_ruby  
/usr/lib/ruby/vendor\_ruby/1.8  
/usr/lib/ruby/vendor\_ruby/1.8/i586-linux  
/usr/lib/ruby/vendor\_ruby  
/usr/lib/ruby/1.8  
/usr/lib/ruby/1.8/i586-linux  
.  
=\> nil  
irb(main):003:0\>

Can anyone please shed some light on what I might have configured  
incorrectly?

Regards  
Mark

---

<div class="post-metadata">

**Author:** ![Jan\_Svitok](https://avatars.discourse-cdn.com/v4/letter/j/cab0a1/32.png) [@Jan\_Svitok](https://rubytalk.org/u/Jan_Svitok)\
**Post date:** [22 March 2007 23:10 UTC](https://rubytalk.org/t/ruby-load-path-and-gems/36374/2 "2007-03-22T23:10:07Z")

</div>

Hi,

have you require'd rubygems? either require 'rubygems' or call ruby  
with --rubygems or add rubygems to your $RUBYOPT variable.

I don't know how you can tell gems where to look for the files, but  
from your printout it seems that gems are not loaded (you'd see  
something like rubygems/custom\_require in the output)

Jano

> **···**
>
> On 3/22/07, mvyver@gmail.com \<mvyver@gmail.com\> wrote:
> 
> > Hi,  
> > I'm a relative newbie to ruby and linux, so please excuse this if it  
> > seems a little naive. Also please accept thanks for all the work that  
> > has gone into a great language.
> > 
> > I thought that if '/usr/lib/ruby/1.8' was in the ruby load path "$:",  
> > then ruby would search for a 'require'd package in subdirectories  
> > under that directory?
> > 
> > for example (as root):  
> > #gem install 'fastercsv' --install-dir='/usr/lib/ruby/1.8'
> > 
> > This installs without error and fastercsv.rb seems to be where it  
> > should:  
> > /usr/lib/ruby/1.8/gems/fastercsv-1.2.0/lib
> > 
> > now (still with root and the same shell session):  
> > mv-laptop:/usr/lib/ruby/1.8 # irb  
> > irb(main):001:0\> require 'fastercsv'  
> > LoadError: no such file to load -- fastercsv  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1:in `require'  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1  
> > irb(main):002:0\> puts $:  
> > /usr/lib/ruby/site\_ruby/1.8  
> > /usr/lib/ruby/site\_ruby/1.8/i586-linux  
> > /usr/lib/ruby/site\_ruby  
> > /usr/lib/ruby/vendor\_ruby/1.8  
> > /usr/lib/ruby/vendor\_ruby/1.8/i586-linux  
> > /usr/lib/ruby/vendor\_ruby  
> > /usr/lib/ruby/1.8  
> > /usr/lib/ruby/1.8/i586-linux  
> > .  
> > =\> nil  
> > irb(main):003:0\>
> > 
> > Can anyone please shed some light on what I might have configured  
> > incorrectly?
> > 
> > Regards  
> > Mark
