Topic: Where to put .gem file in Windows in order to install

I am running Windows 7 and am trying to install the Mechanize gem. I have downloaded the .gem file from here:

http://rubygems.org/gems/mechanize

Now I don't know where in my file tree I should save it so that Ruby will recognize it when I attempt to install it.

I tried saving it in the general file C:\Ruby193 and got this message on attempting to install:

irb(main):001:0> gem install mechanize
NameError: undefined local variable or method `mechanize' for main:Object
        from (irb):1
        from C:/Ruby193/bin/irb:12:in `<main>'


I am an idiot when it comes to stuff like this and I could really use some help. Thanks!

Re: Where to put .gem file in Windows in order to install

You should not start IRB session to install a gem. Just navigate to the folder containing the gem to be installed and hit gem install <gem_name> --local:

- Hit cmd in the 'Start-Execute' to enter the Windows terminal window
C:\Documents and Settings\yourUserName>
cd gem_folder
gem install mechanize --local

ATTENTION, very often a gem has run time dependencies (other gem to install with). Check it in the corresponding dependency section and download all of them. In your case here they are:

Runtime Dependencies

    domain_name >= 0.5.1, ~> 0.5
    mime-types >= 1.17.2, ~> 1.17
    net-http-digest_auth >= 1.1.1, ~> 1.1
    net-http-persistent >= 2.5.2, ~> 2.5
    nokogiri ~> 1.4
    ntlm-http >= 0.1.1, ~> 0.1
    webrobots >= 0.0.9, ~> 0.0

Last edited by Javix (2013-01-30 05:32:30)

Re: Where to put .gem file in Windows in order to install

Thanks so much. I installed it as you suggested and it worked!