gem install rails on VirtualBox Ubuntu guest on a Windows 7 host times out

Apparently if you have the network interface as NAT (the most standard one) then the gem installer has issues connecting to remote sources. Use a bridged network connection, or download all the gems you need separately for rails, and install each using the gem install GEMNAME –local command in the folder where you download the gems. (I couldn’t get the bridged connection to work either, so I just installed all the gems by downloading each gem separately. Sort of annoying, but once you know how to do it, and what the dependencies are (rails has sort of a lot, but not too bad), it is easy. Use rubygems.org and not rubyforge.org)

This is weird since other remote gems work fine. The link at the bottom discusses how this might be a bug or something. Very annoying though, getting to the point where you find that it isn’t a linux problem, but a virtualbox and rubygems thing.

To get to the nitty gritty you have to do sudo gem install -V –debug (for verbose debugging).

The first level of error, by using the -V verbose option will show
Error fetching remote data: timed out (on some remote gem), and then eventually the non-verbose error:

ERROR: While executing gem … (Gem::RemoteFetcher::FetchError) timed out (http://rubygems.org/gems/rails-x.x.x.gem)

To get to the root of the problem, you use the –debug flag which will show

Exception `NameError’ at YOURENV/command_manager.rb:161 – uninitialized constant
Gem::Commands::InstallCommand
Exception `Gem::LoadError’ at YOURENV
rubygems.rb:826 – Could not find RubyGem sources (> 0.0.1)
Exception `Errno::ETIMEDOUT’ at YOURENV/net/

See http://www.ruby-forum.com/topic/204146

Leave a Reply

Your email address will not be published. Required fields are marked *