# Require 'mechanize'/Ruby search path problem

**URL:** <https://www.ruby-forum.com/t/require-mechanize-ruby-search-path-problem/60649>\
**Category:** Ruby\
**Created:** [May 16, 2006, 3:08pm UTC](https://www.ruby-forum.com/t/require-mechanize-ruby-search-path-problem/60649 "2006-05-16T15:08:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 16, 2006, 3:08pm UTC](https://www.ruby-forum.com/t/require-mechanize-ruby-search-path-problem/60649/1 "2006-05-16T15:08:27Z")

</div>

Hello all,

i have installed mechanize from a gem:

sudo gem install mechanize

and it went OK, as far as i am concerned.

However, when i am trying to run any example from the mechanize RDoc, i  
am getting the following error:

LoadError: no such file to load – mechanize

my $: is  
irb(main):010:0\> $:  
=\> ["/usr/local/lib/site\_ruby/1.8",  
“/usr/local/lib/site\_ruby/1.8/i486-linux”,  
“/usr/local/lib/site\_ruby/1.8/i386-linux”, “/usr/local/lib/site\_ruby”,  
“/usr/lib/ruby/1.8”, “/usr/lib/ruby/1.8/i486-linux”,  
“/usr/lib/ruby/1.8/i386-linux”, “.”]

and i have looked up mechanize manually, it’s in

/usr/lib/ruby/gems/1.8/gems/mechanize-0.4.4

i.e. not in $:

Where is the problem? Should not this be automatic? (i.e. that if you  
install a gem, it is installed to a place which is in $:, or the $: is  
updated to contain the installed gem path (/usr/lib/ruby/gems/1.8/gems/  
in my case)?

Or i am doing something terribly wrong? 😉

Thx,  
Peter

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 16, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/require-mechanize-ruby-search-path-problem/60649/2 "2006-05-16T15:26:49Z")

</div>

On May 16, 2006, at 3:06 PM, Peter S. wrote:

> Where is the problem? Should not this be automatic? (i.e. that if  
> you install a gem, it is installed to a place which is in $:, or  
> the $: is updated to contain the installed gem path (/usr/lib/ruby/  
> gems/1.8/gems/ in my case)?
> 
> Or i am doing something terribly wrong? 😉

You must ``require ‘rubygems’’’ before using an installed gem.

– Daniel

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 16, 2006, 3:33pm UTC](https://www.ruby-forum.com/t/require-mechanize-ruby-search-path-problem/60649/3 "2006-05-16T15:33:10Z")

</div>

> You must ``require ‘rubygems’’’ before using an installed gem.  
> Thanks Daniel! It works now!
