# Mechanize for Ruby on Linux not working

**URL:** <https://rubytalk.org/t/mechanize-for-ruby-on-linux-not-working/49059>\
**Category:** ruby-talk\
**Created:** [13 September 2008 07:53 UTC](https://rubytalk.org/t/mechanize-for-ruby-on-linux-not-working/49059 "2008-09-13T07:53:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Just\_Another\_Victim1](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@Just\_Another\_Victim1](https://rubytalk.org/u/Just_Another_Victim1)\
**Post date:** [13 September 2008 07:53 UTC](https://rubytalk.org/t/mechanize-for-ruby-on-linux-not-working/49059/1 "2008-09-13T07:53:07Z")

</div>

The administrator for a server I'm using tried installing Mechanize for  
Ruby using the gem installer. Gem claims that the installation worked  
except that programs trying to use it disagree. Programs trying to use  
Mechanize get this error:

in 'require': no such file to load -- mechanize (LoadError)

&nbsp;&nbsp;&nbsp;&nbsp;Does anyone know what's going wrong? Maybe something hasn't been given  
the right permissions? Maybe gems aren't the way to install modules for  
public use?  
&nbsp;&nbsp;&nbsp;&nbsp;Any help is greatly appreciated, thank you...

---

<div class="post-metadata">

**Author:** ![Stefano\_Crocco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Stefano\_Crocco](https://rubytalk.org/u/Stefano_Crocco)\
**Post date:** [13 September 2008 08:23 UTC](https://rubytalk.org/t/mechanize-for-ruby-on-linux-not-working/49059/2 "2008-09-13T08:23:57Z")

</div>

Alle Saturday 13 September 2008, Just Another Victim of the Ambient Morality  
ha scritto:

> &nbsp;&nbsp;&nbsp;&nbsp;The administrator for a server I'm using tried installing Mechanize for  
> Ruby using the gem installer. Gem claims that the installation worked  
> except that programs trying to use it disagree. Programs trying to use  
> Mechanize get this error:
> 
> in 'require': no such file to load -- mechanize (LoadError)
> 
> &nbsp;&nbsp;&nbsp;&nbsp;Does anyone know what's going wrong? Maybe something hasn't been given  
> the right permissions? Maybe gems aren't the way to install modules for  
> public use?  
> &nbsp;&nbsp;&nbsp;&nbsp;Any help is greatly appreciated, thank you...

Before requiring files installed using rubygems, you need to either require  
'rubygems' or add -rrubygems to the RUBYOPT environment variable. Not doing  
one of these things will give the error you reported.

I hope this helps

Stefano

---

<div class="post-metadata">

**Author:** ![Just\_Another\_Victim1](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@Just\_Another\_Victim1](https://rubytalk.org/u/Just_Another_Victim1)\
**Post date:** [13 September 2008 17:13 UTC](https://rubytalk.org/t/mechanize-for-ruby-on-linux-not-working/49059/3 "2008-09-13T17:13:04Z")

</div>

"Stefano Crocco" \<stefano.crocco@alice.it\> wrote in message  
news:200809131035.06226.stefano.crocco@alice.it...

> Alle Saturday 13 September 2008, Just Another Victim of the Ambient  
> Morality  
> ha scritto:
> 
> > &nbsp;&nbsp;&nbsp;&nbsp;The administrator for a server I'm using tried installing Mechanize  
> > for  
> > Ruby using the gem installer. Gem claims that the installation worked  
> > except that programs trying to use it disagree. Programs trying to use  
> > Mechanize get this error:
> > 
> > in 'require': no such file to load -- mechanize (LoadError)
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;Does anyone know what's going wrong? Maybe something hasn't been  
> > given  
> > the right permissions? Maybe gems aren't the way to install modules for  
> > public use?  
> > &nbsp;&nbsp;&nbsp;&nbsp;Any help is greatly appreciated, thank you...
> 
> Before requiring files installed using rubygems, you need to either  
> require  
> 'rubygems' or add -rrubygems to the RUBYOPT environment variable. Not  
> doing  
> one of these things will give the error you reported.
> 
> I hope this helps

&nbsp;&nbsp;&nbsp;&nbsp;I think it has! I haven't written a program that uses these modules in  
earnest yet but my simple test program would suggest that it's working. I'm  
guessing the Windows installer must set this environment variable  
automatically and that's why I've never heard of this, before...  
&nbsp;&nbsp;&nbsp;&nbsp;Just to solidify my understanding, if this module had not been installed  
using rubygems, would a simple require have worked?  
&nbsp;&nbsp;&nbsp;&nbsp;Thanks again!

---

<div class="post-metadata">

**Author:** ![Cameron\_McBride](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Cameron\_McBride](https://rubytalk.org/u/Cameron_McBride)\
**Post date:** [14 September 2008 19:17 UTC](https://rubytalk.org/t/mechanize-for-ruby-on-linux-not-working/49059/4 "2008-09-14T19:17:21Z")

</div>

yes.

Cameron

> **···**
>
> On Sat, Sep 13, 2008 at 12:13 PM, Just Another Victim of the Ambient Morality \<ihatespam@hotmail.com\> wrote:
> 
> > "Stefano Crocco" \<stefano.crocco@alice.it\> wrote in message  
> > news:200809131035.06226.stefano.crocco@alice.it...
> > 
> > > Alle Saturday 13 September 2008, Just Another Victim of the Ambient  
> > > Morality  
> > > ha scritto:
> > > 
> > > > &nbsp;&nbsp;&nbsp;&nbsp;The administrator for a server I'm using tried installing Mechanize  
> > > > for  
> > > > Ruby using the gem installer. Gem claims that the installation worked  
> > > > except that programs trying to use it disagree. Programs trying to use  
> > > > Mechanize get this error:
> > > > 
> > > > in 'require': no such file to load -- mechanize (LoadError)
> > > > 
> > > > &nbsp;&nbsp;&nbsp;&nbsp;Does anyone know what's going wrong? Maybe something hasn't been  
> > > > given  
> > > > the right permissions? Maybe gems aren't the way to install modules for  
> > > > public use?  
> > > > &nbsp;&nbsp;&nbsp;&nbsp;Any help is greatly appreciated, thank you...
> > > 
> > > Before requiring files installed using rubygems, you need to either  
> > > require  
> > > 'rubygems' or add -rrubygems to the RUBYOPT environment variable. Not  
> > > doing  
> > > one of these things will give the error you reported.
> > > 
> > > I hope this helps
> > 
> > &nbsp;&nbsp;&nbsp;I think it has! I haven't written a program that uses these modules in  
> > earnest yet but my simple test program would suggest that it's working. I'm  
> > guessing the Windows installer must set this environment variable  
> > automatically and that's why I've never heard of this, before...  
> > &nbsp;&nbsp;&nbsp;Just to solidify my understanding, if this module had not been installed  
> > using rubygems, would a simple require have worked?  
> > &nbsp;&nbsp;&nbsp;Thanks again!
