13

I would like to download a gem without installing all the required gems for a given gem.

Specifically for the Rails 3 gem. It has a lot of dependencies, and I need to install it on a closed server which currently has no ruby/rake/rails software.

Any clues would be great as clicking through rubygems.org is tedious.

okay, let me clarify this a bit. What I would like is for this to work:

gem install rails --download-only

which would solve my problems as then I could burn the resulting gem's onto a disc and move them over to my server which doesn't have Internet access.

1
  • Not sure that this is possible. That is why they are called dependencies. They depend on other things that you have to have to work.
    – soandos
    Aug 19, 2011 at 18:45

4 Answers 4

22

To download a single gem use (using loudmouth gem as an example):

gem fetch loudmouth
Fetching: loudmouth-0.2.4.gem (100%)
Downloaded loudmouth-0.2.4

to download all gems that your Rails 3 app depends on run:

bundle package

This will download all gems (and their dependencies) and place them into vendor/cache (without installing them).

You can then burn all the gems in vendor/cache to a CD and physically bring it to the other server without net access.

2
  • A bit too late to use, but this is the answer I was looking for. Thanks for posting it.
    – Daniel
    Oct 25, 2012 at 1:17
  • 2
    You need to specify --no-install to bundle package to skip installation.
    – xoryves
    Sep 21, 2017 at 8:04
3

Well, I hate to answer my own question but I think this is the most likely to be the solution for my question.

- find network enabled machine
- install rails and all needed gems using RubyGems.
- tar/zip /usr/lib[64]/ruby/gem/1.9.1/cache/*.gem
- transport tar file to non-networked computer.

The location of those gem cached files is very useful. If I had numerous gem's on my networked machine and didn't want to transport all the gems I would have used

> bundle list

to show the application specific gems needed.

-daniel

2

I would create a local RubyGems server with all the gems required for the application, including Rails and its dependencies.

Basic documentation here:

This blog post shows how to set up an internal server that you can send Gems to for automatic indexing:

0

Unfortunately you cannot get around the dependency issue. They are needed for a reason; Trying to install Rails without needed dependencies is going to result in a lot of issues, if Rails even runs at all.

You didn't specify exactly what you meant by closed. If you mean closed as in you cannot install systemwide software, have a look at RVM, which is software that will allow you to create a self-contained Ruby environment. You might also be able to get away with setting this up on another server and moving it over if the server has no connection to the internet. Have a look at it and see if this helps you out.

1
  • If I can't manually download the gem's then I'll probably have to use this method: I'll use a linux VM and create a rails complete install package.
    – Daniel
    Aug 19, 2011 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .