Gem install hangs indefinitely

23,788

Solution 1

If gem install is hanging, it's most likely a network, proxy, or firewall issue on your end.

You can investigate by issuing your gem install command in verbose mode with -V. It'll show you what URLs it's communicating with to download the gem, and you can hopefully see what it's doing and where it's hanging:

> gem install -V middleman
HEAD https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
...

You can also check status.rubygems.org where they'll alert you in case the gem/spec servers do have problems (see screenshot below):

RubyGem.org status screenshot

Solution 2

Found my problem! I was runnning ruby 1.8.7. I needed to update my .zshrc file to use 1.9.3 as default.

What I did was put this on my .zshrc file:

rvm use 1.9.3 --default

Solution 3

You seem to be on Mac. Have you Xcode installed?

The cite from MiddleMan official:

Mac OS X comes prepackaged with both Ruby and Rubygems, however, some of the Middleman's dependencies need to be compiled during installation and on OS X that requires Xcode. Xcode can be installed via the Mac App Store. Alternately, if you have a free Apple Developer account, you can just install Command Line Tools for Xcode from their downloads page.

BTW, just out of curiousity, is your connection OK? Try to run ping google.com in the sibling terminal during gem install ….

Solution 4

In case this helps someone, my terminal was hanging on

gem update --system

and changing it to

sudo gem update --system

fixed it.

Share:
23,788
rvazquez
Author by

rvazquez

UI/UX and iOS Designer at FreshBooks. Teacher. Rower. Interested in culture, design, aesthetic, wit, reality, existence, thought, and the pursuit of happiness. I love art. I love code. I love coding art.™

Updated on August 26, 2021

Comments

  • rvazquez
    rvazquez over 2 years

    Background: I'm a designer that works well with HTML, CSS, and JS. But when it comes to setting up my environment is where I fall short.

    I recently purchased a home computer. I want to set up Middleman to use in a project. I already installed rvm and all its requirements. I am on ruby-2.0.0-p0, which from what I understand is the latest stable release.

    When I attempt to install Middleman, or any other gem for that matter, nothing happens. The cursor just moves to the next line. Screenshot

    Some guidance, or troubleshooting steps, would be greatly appreciated!

    Thank you,

    Ricardo

  • rvazquez
    rvazquez about 11 years
    Thanks for your answer mudasobwa :). I do have XCode installed, as well as Command Line Tools installed. I ran ping google.com and it is showing that I have a connection. Nothing seems to be working unfortunately :(
  • Peter
    Peter over 5 years
    This was the reason and this is the solution for it: stackoverflow.com/questions/4418/…
  • Alvin Smith
    Alvin Smith almost 3 years
    try again after turn off your proxy and vpn stuff
  • karatedog
    karatedog almost 2 years
    Is there any method to try when gem update -V does not output anything?