# Ruby and paths

**URL:** <https://www.ruby-forum.com/t/ruby-and-paths/115002>\
**Category:** Ruby\
**Created:** [September 19, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/ruby-and-paths/115002 "2007-09-19T17:05:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fibre\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b4bc9f/32.png) [@Fibre\_O](https://www.ruby-forum.com/u/Fibre_O)\
**Post date:** [September 19, 2007, 5:05pm UTC](https://www.ruby-forum.com/t/ruby-and-paths/115002/1 "2007-09-19T17:05:42Z")

</div>

Hello iahve just installed Ruby grom sources. Here i a command I have  
executed:  
$ruby -v  
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]

Unfortunately I am not able to start up the irb:  
$irb -v  
/usr/bin/irb:10:in `require’: no such file to load – irb (LoadError)  
from /usr/bin/irb:10

Yhe irb. rb is available undet the following directory:  
$find / -name irb.rb  
/lib/ruby/1.8/irb.rb

What should I to addjust? How the ruby searches when looking for  
libraris i.e. irb.rb or socket.rb? How to fix the problem?

Regards,  
FO

---

<div class="post-metadata">

**Author:** ![Fibre\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b4bc9f/32.png) [@Fibre\_O](https://www.ruby-forum.com/u/Fibre_O)\
**Post date:** [September 19, 2007, 5:48pm UTC](https://www.ruby-forum.com/t/ruby-and-paths/115002/2 "2007-09-19T17:48:57Z")

</div>

Alle mercoledì 19 settembre 2007, Fibre O. ha scritto:

> Yhe irb. rb is available undet the following directory:  
> $find / -name irb.rb  
> /lib/ruby/1.8/irb.rb
> 
> What should I to addjust? How the ruby searches when looking for  
> libraris i.e. irb.rb or socket.rb? How to fix the problem?
> 
> Regards,  
> FO

You can see the ruby load path with the following command:

ruby -e ‘puts $:’

The ruby load path (which can be accessed from ruby using the $:  
variable) is  
made by some hard coded directories, depending on the installation path  
passed to the configure script, by the contents of the RUBYLIB  
environment  
variable and by directories passed to ruby via the -I command line  
option.

From what you posted, it seems that the ruby executable (at least, the  
irb  
executable) is installed with a different prefix than the ruby libraries  
(the  
former in /usr, the latter in /). This is a setup I’ve never tried, but  
I  
think can be obtained passing options like --bindir and the like to  
configure. If you didn’t use such options, I’d suggest you to reinstall  
ruby  
passing only the --prefix=/usr option to the configure script. This  
should  
leave you with the following setup:

/usr/bin/  
ruby  
irb  
erb  
rdoc  
…

/usr/lib/ruby/1.8/  
abbrev.rb  
benchmark.rb  
irb.rb  
irb  
bigdecimal  
…

If you truly meant to install the libraries there, I can’t help you much  
(as I  
said, I’ve no experience with that setup). You can try adding  
/lib/ruby/1.8  
to the RUBYLIB environment variable or passing the -I/lib/ruby/1.8  
option to  
irb.

I hope this helps

Stefano

---

<div class="post-metadata">

**Author:** ![Fibre\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b4bc9f/32.png) [@Fibre\_O](https://www.ruby-forum.com/u/Fibre_O)\
**Post date:** [September 19, 2007, 7:35pm UTC](https://www.ruby-forum.com/t/ruby-and-paths/115002/3 "2007-09-19T19:35:42Z")

</div>

Stefano C. wrote:

> From what you posted, it seems that the ruby executable (at least, the irb  
> erb
> 
> If you truly meant to install the libraries there, I can’t help you much (as I  
> said, I’ve no experience with that setup). You can try adding /lib/ruby/1.8  
> to the RUBYLIB environment variable or passing the -I/lib/ruby/1.8 option to  
> irb.

Hi,

it was nice hint… at first attempt I tried to configure ruby on this  
way:  
./configure   
–target=$(GNU\_TARGET\_NAME)   
–host=$(GNU\_TARGET\_NAME)   
–build=$(GNU\_HOST\_NAME)   
$(DISABLE\_NLS)   
$(DISABLE\_LARGEFILE)   
–prefix=/usr   
–exec-prefix=/usr   
–bindir=/usr/bin   
–sbindir=/usr/sbin   
–libdir=/lib   
–libexecdir=/usr/lib   
–sysconfdir=/etc   
–datadir=/usr/share   
–localstatedir=/var   
–mandir=/usr/man   
–infodir=/usr/info \

Unfortunately it did no work… after I received your answer I tried  
this:  
./configure   
–target=$(GNU\_TARGET\_NAME)   
–host=$(GNU\_TARGET\_NAME)   
–build=$(GNU\_HOST\_NAME)   
$(DISABLE\_NLS)   
$(DISABLE\_LARGEFILE)   
–prefix=/usr \

and it works good!

Regards,  
FO
