Ask Your Question

install gem without internet connection

asked 2017-01-04 10:42:06 -0600

puser gravatar image

I have a sandbox server that I need to install some gems on, specifically rspec. How can I install this gem without doing a gem install command? Here is the github repo

gem install rspec ERROR: Could not find a valid gem 'rspec' (>= 0) in any repository ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNREFUSED: Connection refused - connect(2) (

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-04 11:49:20 -0600

DarylW gravatar image

updated 2017-01-04 11:49:49 -0600

You will need to download all of the appropriate gems that you require, get them to your offline server (sneakernet), and then install them locally.

This first answer talks about the mechanics of installing a .gem file 'locally' instead of reaching out to a rubygem server

You can use bundler to create a 'package' of a gem and all of its dependencies on your connected machine, and then install that using gem install --local my_gem_bundle.gem

You also can run your own gem server, and reference that in your offline network. It still requires you to bring down the gems that you need, and load them into your server.

If you wish to install an individual gem using puppet, you can do something like the following for an offline setup.

You can use puppet's package type with the gem provider, and supply the 'source' gem file for installing gems. The problem is that it won't do any dependency resolution for you, you would have to order your installs manually yourself.

One thing that you may have to do (if you are not using the --local flag while trying to install your gems) is remove from your list of gem sources. gem sources -r

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-01-04 10:42:06 -0600

Seen: 802 times

Last updated: Jan 04 '17