# Mechanize problem, cant require nor install

**URL:** <https://rubytalk.org/t/mechanize-problem-cant-require-nor-install/48442>\
**Category:** ruby-talk\
**Created:** [19 August 2008 15:28 UTC](https://rubytalk.org/t/mechanize-problem-cant-require-nor-install/48442 "2008-08-19T15:28:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Akhtar](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@Adam\_Akhtar](https://rubytalk.org/u/Adam_Akhtar)\
**Post date:** [19 August 2008 15:28 UTC](https://rubytalk.org/t/mechanize-problem-cant-require-nor-install/48442/1 "2008-08-19T15:28:44Z")

</div>

Hi Im following the simple mechanize tutorial on  
[http://ruby-doc.org/core/](http://ruby-doc.org/core/)  
i fire up irb  
then type and see the following

irb(main):001:0\> require 'rubygems'  
=\> true  
irb(main):002:0\> require 'mechanize'  
LoadError: no such file to load -- mechanize  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from  
C:/InstantRails\_Ver2/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_re  
quire.rb:27:in `gem\_original\_require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from  
C:/InstantRails\_Ver2/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_re  
quire.rb:27:in `require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2  
irb(main):003:0\>

so i tried to install it via rubygems but...

C:/InstantRails\_Ver2/ruby/bin/ruby.exe extconf.rb install mechanize  
--remote  
checking for stdio.h... no  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

not sure whats going. This is my ruby version  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

and im using Instant Rails

here is my gem list

actionmailer (2.0.2, 1.3.6)  
actionpack (2.0.2, 1.13.6)  
actionwebservice (1.2.6)  
activerecord (2.0.2, 1.15.6)  
activeresource (2.0.2)  
activesupport (2.0.2, 1.4.4)  
capistrano (2.1.0)  
cgi\_multipart\_eof\_fix (2.5.0)  
cmdparse (2.0.2)  
fxri (0.3.6)  
fxruby (1.6.12)  
gem\_plugin (0.2.3)  
highline (1.4.0)  
hpricot (0.6)  
log4r (1.0.5)  
mongrel (1.1.2)  
mysql (2.7.3)  
needle (1.3.0)  
net-sftp (1.1.0)  
net-ssh (1.1.2)  
rails (1.2.6)  
rake (0.8.1, 0.8.0, 0.7.3)  
rubygems-update (1.0.1)  
sources (0.0.1)  
sqlite3-ruby (1.2.1)  
win32-api (1.0.4)  
win32-clipboard (0.4.3)  
win32-dir (0.3.2)  
win32-eventlog (0.4.6)  
win32-file (0.5.4)  
win32-file-stat (1.2.7)  
win32-process (0.5.3)  
win32-sapi (0.1.4)  
win32-sound (0.4.1)  
windows-api (0.2.0)  
windows-pr (0.7.2)

anyone know how i can fix this?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Aaron\_Patterson1](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@Aaron\_Patterson1](https://rubytalk.org/u/Aaron_Patterson1)\
**Post date:** [21 August 2008 03:52 UTC](https://rubytalk.org/t/mechanize-problem-cant-require-nor-install/48442/2 "2008-08-21T03:52:48Z")

</div>

Don't use extconf.rb to install gems. You need to use the "gem" command  
like so:

&nbsp;&nbsp;$ gem install mechanize

Hope that helps!

> **···**
>
> On Wed, Aug 20, 2008 at 12:28:44AM +0900, Adam Akhtar wrote:
> 
> > Hi Im following the simple mechanize tutorial on  
> > [RDoc Documentation](http://ruby-doc.org/core/)  
> > i fire up irb  
> > then type and see the following
> > 
> > irb(main):001:0\> require 'rubygems'  
> > =\> true  
> > irb(main):002:0\> require 'mechanize'  
> > LoadError: no such file to load -- mechanize  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from  
> > C:/InstantRails\_Ver2/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_re  
> > quire.rb:27:in `gem\_original\_require'  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from  
> > C:/InstantRails\_Ver2/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_re  
> > quire.rb:27:in `require'  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):2  
> > irb(main):003:0\>
> > 
> > so i tried to install it via rubygems but...
> > 
> > C:/InstantRails\_Ver2/ruby/bin/ruby.exe extconf.rb install mechanize  
> > --remote  
> > checking for stdio.h... no  
> > \*\*\* extconf.rb failed \*\*\*  
> > Could not create Makefile due to some reason, probably lack of  
> > necessary libraries and/or headers. Check the mkmf.log file for more  
> > details. You may need configuration options.
> 
> --  
> Aaron Patterson  
> [http://tenderlovemaking.com/](http://tenderlovemaking.com/)

---

<div class="post-metadata">

**Author:** ![Lex\_Williams](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@Lex\_Williams](https://rubytalk.org/u/Lex_Williams)\
**Post date:** [21 August 2008 05:39 UTC](https://rubytalk.org/t/mechanize-problem-cant-require-nor-install/48442/3 "2008-08-21T05:39:57Z")

</div>

even when installed with gem , I encounter a problem ( if it's really a  
problem ) : if I step through my code ( ruby -rdebug code.rb ) , the  
debugger dies at the line 'require "mechanize"' ; I mention that I have  
included 'require "rubygems"' as the first line .  
However , if I set a breakpoint in my code , somewhere past that line ,  
I can reach it . Could someone give me an explanation please ?

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
