Unable to access RubyGems - maybe due to SSL?

The new Ruby on Rails dev is here, just trying to install and configure.

I follow this guide on how to get started. However, when I get to 3.2. Creating a Blog application, I have a problem when starting rails new blog . When I try to do this, I get an error

An error occurred while installing rake 10.4.2, and the Bundler cannot continue. Make sure "gem install rake -v" 10.4.2 '' succeeds before binding.

So, when I try to run this command, I get this error:

ERROR: Could not find a valid gem 'rake': failed to load data from https://rubygems.org/ - SSL_connect returned = 1 errno = 0 state = SSLv3 server authentication certificate B: certificate verification completed

After Googling, I found this guide . During the diagnosis, I tried to run openssl version , which did not work. I installed OpenSSL and added it to my path. However, I still get the same error when I try to get any gems. I also can not ping rubygems.org - nothing returns.

I am using Windows 7, Rails 4.1.8, Ruby 2.0.0p598, RubyGems 2.0.14 and OpenSSL 1.01j. Any help would be greatly appreciated!

+8
ruby ruby-on-rails ssl rubygems
source share
2 answers

Here is a quick solution:

Go to your gem file and change

 source 'https://rubygems.org' 

to

 source 'http://rubygems.org' #remove the 's' 

Check out this similar question on StackOverflow for more solutions and an understanding of the error :)

Edit:

Based on @Anthony's entries in the comments below, here is a more permanent solution:

Download: AddTrustExternalCARoot-2048.pem (Note: the file must have .pem as an extension. Browsers such as Chrome will try to save it as a regular text file. Make sure you change the name of the file to have .pem in it after downloading it. )

Now run the following at a command prompt:

 C:\>gem which rubygems 

Thiw will provide you with a path where you need to place the above .pem file. Change to the directory pointed to by the path. Inside, find the ssl_certs directory and copy the .pem file obtained from the previous step inside.

This will do the trick!

+20
source share

This is due to a Windows resolution problem, you can read the full scope of the problem here

For tl; dr -

Step 1: Get a New Certificate of Trust

Download: AddTrustExternalCARoot-2048.pem

Step 2. Locate the RubyGems certificate directory in your installation

 C:\>gem which rubygems C:/Ruby21/lib/ruby/2.1.0/rubygems.rb 

We want to open the path indicated above:

 C:\>start C:\Ruby21\lib\ruby\2.1.0\rubygems 

Step 3: Copy the New Trust Certificate

Now find the ssl_certs directory and copy the .pem file that we got from step 1 inside.

+19
source share

All Articles