Ruby Gem Installation Error

5.4k views Asked by At

I have been unable to install Ruby on Rails gems on my computer. Here is what I typed and the responses I received.

C:\Users\029607\Documents\NDAC Tech Studies\TES3>gem install bundler --source "http://rubygems.org"

This is the response:

Successfully installed bundler-1.5.3
WARNING:  Unable to pull data from 'https://rubygems.org/': SSL_connect SYSCALL
returned=5 errno=0 state=SSLv2/v3 read server hello A (https://api.rubygems.org/
latest_specs.4.8.gz)
1 gem installed

C:\Users\029607\Documents\NDAC Tech Studies\TES3>bundle install

Fetching source index from https://rubygems.org/
Retrying source fetch due to error (2/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying source fetch due to error (3/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
2

There are 2 answers

0
notapatch On

You need to get more information: bundle install --verbose

I was getting the same error and when I did bundle install verbose it became clearer. In my case ..

Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Connection timed out 
 - connect(2) for "s3.amazonaws.com" port 443 (https://rubygems.org/specs.4.8.gz)

It indicated that there was firewall issues (you need to allow firewall access to rubygems.org and s3.amazonaws.com on port 443).

I was doing nslookup rubygems.org getting the ip address and using it in whois ip address and using the CIDR addresses (54.240.0.0/12 etc) to allow access to the ruby gems through the firewall. My Iptables for Rubygems looked like this along with permitting established traffic. (You could equally have a policy of permit on outbound traffic and you wouldn't need complicated firewall tables ;-) )

-A service -d 54.240.0.0/12 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 205.251.192.0/18 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 54.216.0.0/14 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 54.220.0.0/15 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 54.208.0.0/13 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT

Rich

0
DDDD On

This seems to be an issue with Ruby and your TLS handshake. Try defining a certificate here.

Here are other possible solutions.