This help site has been deprecated. Please send your requests to support@rubygems.org

Installing RubyGems on machine not connected to Internet

wolf_volpi's Avatar

wolf_volpi

02 Sep, 2011 05:41 AM

I need to install RubyGems onto a machine that is isolated from the Internet (permanently offline). I appreciate your advice. I am new to Ruby & Gems and have read the Gems manual.

Please tell me if you see any problems with the following plan. The first 3 steps are on a PC that is connected to the Internet.

  1. download RubyGems from http://rubyforge.org/frs/?group_id=126

  2. Install RubyGems

  3. Get the gems I need:
    gem fetch cucumber --version 0.10.7

  4. Sneeker-net the gems to the isolated machine.

  5. Install the gems on the isolated machine:
    gem install cucumber --version 0.10.7 --local

I still have some basic questions:

  1. Do I need Ruby to run RubyGems commands?

  2. Why is the "fetch" command not in the RubyGems manual?

  3. Does "fetch" recursively download all the dependencies the way "install" does?

  4. Does the "install" command do more than download a copy into the local machine?
    If not, how is "install" different than "fetch"?

Thank you for helping.

  1. Support Staff 1 Posted by Eric Hodel on 02 Sep, 2011 09:00 PM

    Eric Hodel's Avatar
    1. You need Ruby to use RubyGems.

    2. gem help is the authoritative reference for RubyGems commands.

    3. The easiest way to get the dependencies is gem install -i tmp cucumber -v 0.10.7 then move tmp/cache/*.gem to the disconnected machine and run gem install -f --local *.gem

    4. fetch only downloads a single gem file to the current directory. Install makes it usable by ruby.

  2. 2 Posted by wolf_volpi on 04 Sep, 2011 07:22 AM

    wolf_volpi's Avatar

    Thanks Eric. I followed your instructions but got some errors. I probably got something wrong. Please take a look.

    I am trying to install the Cucumber Gem on my home PC off-line before I attempt the install at work. After downloading all the necessary files, I disconnected the Ethernet cable from my PC, to simulate an off-line installation.

    Attached is a play-by-play of my attempted install, error messages included. The first part is setting up Ruby on Windows 7. You can skip down to “Cucumber download & install”. Installing Cucumber generated 130 lines of output with 3 RuntimeErrors. I don't know enough about Gems to make sense of the Error messages. Please help me figure out the error messages.

    Thank you for your guidance.

  3. 3 Posted by Luis Lavena on 04 Sep, 2011 12:39 PM

    Luis Lavena's Avatar

    Hello,

    Your problem seems to be very particular.

    This error:

    > gem install -f --local *.gem
    Successfully installed builder-3.0.0
    Temporarily enhancing PATH to include DevKit...
    Building native extensions.  This could take a while...
    ERROR:  Error installing cucumber-0.10.7.gem:
            ERROR: Failed to build gem native extension.
    
            C:/Ruby192/bin/ruby.exe extconf.rb
    checking for re.h... *** 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.
    

    Indicate it was unable to compile one of the extensions cucumber depends on.

    As indicated in the results, please send us mkmf.log contents so we can see why it failed.

    You can find the file here: C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.5.4/ext/json/ext/parser/

    Most of the time, it is associated with some weird environment issues documented here:

    https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting

    Please verify that none of these issues are affecting your environment (speciall AutoRun)

  4. 4 Posted by wolf_volpi on 04 Sep, 2011 01:49 PM

    wolf_volpi's Avatar

    Thanks Luis.
    I followed the autorun trouble shooting. I have two different values for PathCompletionChar key; does that matter?

    D:\wolf\Software\cucumber\tmp\bin\cache
    > SET COMSPEC
    ComSpec=C:\Windows\system32\cmd.exe
    
    D:\wolf\Software\cucumber\tmp\bin\cache
    > REG QUERY "HKCU\Software\Microsoft\Command Processor"
    
    HKEY_CURRENT_USER\Software\Microsoft\Command Processor
        CompletionChar    REG_DWORD    0x9
        DefaultColor    REG_DWORD    0x0
        EnableExtensions    REG_DWORD    0x1
        PathCompletionChar    REG_DWORD    0x9
    
    
    D:\wolf\Software\cucumber\tmp\bin\cache
    > REG QUERY "HKLM\Software\Microsoft\Command Processor"
    
    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor
        CompletionChar    REG_DWORD    0x40
        DefaultColor    REG_DWORD    0x0
        EnableExtensions    REG_DWORD    0x1
        PathCompletionChar    REG_DWORD    0x40
    
  5. 5 Posted by Luis Lavena on 04 Sep, 2011 01:55 PM

    Luis Lavena's Avatar

    No, as the Troubleshooting page mentions, only AutoRun key matters.

    The attached mkmf.log seems incomplete, is missing certain information.

    Can you attach the file in verbatim format?

    Thank you.

  6. 6 Posted by wolf_volpi on 04 Sep, 2011 02:17 PM

    wolf_volpi's Avatar

    Luis,

    What is " verbatim format"? I opened the attachment and it looks just like the mkmk.log file on my PC. Here is mkmk.log pasted into the comment:

    "gcc -o conftest -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby192/include/ruby-1.9.1/ruby/backward -IC:/Ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -O3 -Wall conftest.c -L. -LC:/Ruby192/lib -L. -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\tk\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\tcl\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\libyaml\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\pdcurses\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\openssl\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\zlib\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\iconv\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\gdbm\lib -LC:\Users\Luis\Projects\oss\oneclick\rubyinstaller\sandbox\libffi\lib -lmsvcrt-ruby191-static -lshell32 -lws2_32 " checked program was:
    / begin / 1: #include "ruby.h"
    2:
    3: #include <winsock2.h>
    4: #include <windows.h>
    5: int main() {return 0;}
    / end /

  7. 7 Posted by Luis Lavena on 04 Sep, 2011 02:37 PM

    Luis Lavena's Avatar

    Attached is how mkmf.log looks on my system. Notice the have_header mention there.

    Can you attempt normal installation of the gem with internet? want to see if the error is coming because of local gem installation since it worked before in your system.

  8. 8 Posted by wolf_volpi on 04 Sep, 2011 03:29 PM

    wolf_volpi's Avatar

    Luis,

    I attempted gem install connected to the Internet:

    gem install cucumber --version 0.10.7
    

    It returned one "Failed to build gem native extension." Full output is attached.
    The mkmf.log file appears unchanged, also attached.

  9. 9 Posted by wolf_volpi on 06 Sep, 2011 04:34 AM

    wolf_volpi's Avatar

    I uninstalled all gems and attempted to install Cucumber gem again, but got the same error.

    So now I want to uninstall DevKit before attempting another install.
    What is the procedure for uninstalling DevKit?
    Or should I just roll back to the previous restore point?

    Thank you for your advice.

  10. 10 Posted by Luis Lavena on 06 Sep, 2011 10:31 AM

    Luis Lavena's Avatar

    Hello,

    Restore points will not handle that. You can remove DevKit directory safely.

    I'm still baffled by something that works with internet connection but fails in your attempts of installation locally.

    I'll try to reproduce this today.

  11. 11 Posted by Luis Lavena on 06 Sep, 2011 10:32 AM

    Luis Lavena's Avatar

    Forgot to mention:

    If you use the same Ruby installation to install the DevKit again, you will need to do ruby dk.rb install --force to override the existing configuration files.

    If you decide to remove your Ruby installation first, please also remove the Ruby directory afterwards before installing again.

  12. 12 Posted by wolf_volpi on 07 Sep, 2011 01:06 AM

    wolf_volpi's Avatar

    Luis,

    Thanks for the tips.

    The previous Internet connected and local install attempts both failed: "Failed to build gem native extension."

    In a few hours I will uninstall and attempt install again. I will post the results.

    Thanks.

  13. 13 Posted by wolf_volpi on 07 Sep, 2011 04:18 AM

    wolf_volpi's Avatar

    Luis,

    Where is the DevKit directory? All I found is a devkit file C:/Ruby192/lib/ruby/site_ruby/devkit.rb

    Thanks.

  14. 14 Posted by Luis Lavena on 07 Sep, 2011 10:24 AM

    Luis Lavena's Avatar

    Did you follow the DevKit installation instructions?

    https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

    DevKit will be where you extracted it.

    As I mentioned before: the files that DevKit installed inside your current Ruby installation can be replaced using ruby dk.rb install --force so you can safely ignore those.

    Please also try a clean installation, meaning remove this Ruby installation, remove the directory and start again.

  15. 15 Posted by wolf_volpi on 08 Sep, 2011 12:14 AM

    wolf_volpi's Avatar

    Luis,

    OK, now I understand that "install DevKit" is the same as "extract DevKit file into directory".
    My DevKit directory is D:\wolf\Software\cucumber\DevKit
    My Ruby directory is C:\Ruby192
    Should Ruby and DevKit be on the same partition?

  16. 16 Posted by Luis Lavena on 08 Sep, 2011 12:18 AM

    Luis Lavena's Avatar

    OK, now I understand that "install DevKit" is the same as "extract DevKit file into directory".

    Is not just extract, but follow the installation instructions in the wiki page.

    https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

    Is not necessary both are on the same partition, but I recommend you extract it to C:\DevKit instead, so is close to your Ruby installation.

  17. 17 Posted by wolf_volpi on 08 Sep, 2011 04:58 AM

    wolf_volpi's Avatar

    It worked after a full unistall and reinstall. Thanks for your help Luis.
    The following is the uinstall procedure I used if anyone else needs it.

    Uninstall Cucumber gems, DevKit, DevKit, and Ruby from Windows 7:

    from Windows PowerShell --------------------------------------
    uninstall Cucumber gems:
    PS C:\Users\wolf> gem list | %{$.split(' ')[0]} | %{gem uninstall -Iax $ }

    from Command Prompt --------------------------------------
    confirm all gems were deleted

    gem list
    
    *** LOCAL GEMS ***
    

    remove DevKit directory:

    D:
    cd D:\wolf\Software\cucumber\
    rd /s DevKit
    

    remove Ruby from Control Panel:

    Control Panel > Programs > Uninstall > select Ruby, click Unistall
    

    remove the Ruby folder:

    rd /s Ruby192
    
  18. Luis Lavena closed this discussion on 14 Sep, 2011 11:31 AM.

Discussions are closed to public comments.
If you need help with RubyGems.org please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac