Question

I have no internet connection on server machine, so I need to install gems locally. I tried

gem install rails-2.3.4.gem

But, I'm getting errors.

How Can I install gems locally.

Thanks.

Was it helpful?

Solution

You could either

  1. Find all the dependencies of the gem and install them with gem install

    or better

  2. Copy the gem dirs from another machine (same O.S. etc). You can find the required directory by running the gem environment command and noting the GEM PATHS (see below). You may also have to copy files from the EXECUTABLE DIRECTORY.

    RubyGems Environment:

    • RUBYGEMS VERSION: 1.3.2
    • RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
    • INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
    • RUBY EXECUTABLE: /usr/bin/ruby1.8
    • EXECUTABLE DIRECTORY: /usr/bin
    • RUBYGEMS PLATFORMS:
      • ruby
      • x86-linux
    • GEM PATHS:
      • /usr/lib/ruby/gems/1.8
      • /home/chris/.gem/ruby/1.8
    • GEM CONFIGURATION:
    • REMOTE SOURCES:

OTHER TIPS

If you are working with Rails, I'd suggest unpacking the gems you need to vendor before deploying to the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top