Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access RubyGems - possibly due to SSL? [duplicate]

New Ruby on Rails dev here, just trying to install and get set up.

I'm following this guide on how to get started. However, when I get to 3.2 Creating the Blog Application, I run into an issue when I run rails new blog. When I try that, I get an error that says

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

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

ERROR: Could not find a valid gem 'rake': Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

After Googling around, I found this guide. During the diagnosis portion, I tried running openssl version, which didn't work. I installed OpenSSL and added it to my path. However, I still get the same error when I try to fetch any gems. I also can't ping rubygems.org - nothing comes back.

I'm 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!

like image 220
iaacp Avatar asked Dec 08 '14 18:12

iaacp


1 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 this similar question on StackOverflow for more solutions and insights into the error :)

Edit:

Based on inputs by @Anthony in the comments below, here is a more permanent solution :

Download : AddTrustExternalCARoot-2048.pem.(Note: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to have .pem in it after you have downloaded it.)

Now Run the following in your command prompt:

C:\>gem which rubygems

Thiw will give you a path where you need to place the above .pem file. Navigate inside the directory to which the path points. Inside it locate ssl_certs directory and copy the .pem file we obtained from previous step inside.

This shall do the trick!

like image 193
Aaditi Jain Avatar answered Oct 17 '22 23:10

Aaditi Jain