The simplest way to download a gem without installing rubygems

railsruby

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.

Best Answer

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.

Related Question