Instantly share code, notes, and snippets.

Embed
What would you like to do?
Workaround RubyGems' SSL errors on Ruby for Windows (RubyInstaller)

SSL upgrades on rubygems.org and RubyInstaller versions

UPDATE 2016-12-01: Please refer to the official guide instead of this process.

UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.


Hello,

If you reached this page, means you've hit this SSL error when trying to pull updates from RubyGems:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

This error is produced by changes in rubygems.org infrastructure, please keep reading to better understand it.

If you're one of those too long, didn't read just skip to the guide on how to workaround it.

Background

For those who are not familiar with SSL and certificates, there are many parts that make secure serving of content possible.

SSL certificates are used on the website, which are obtained from a certificate authority (CA) and generated from a private key, along with its respective signature.

Normally and up until a few months ago, private key signatures used SHA-1 as way to provide a digest (or checksum) of the private key without distributing the key itself (remember, needs to remain private).

SHA-1 has been encountered weak and lot of web servers and sites have been upgrading towards SHA-2 (specifically SHA256 or higher) in order to prepare for the browsers changes.

Specific problem with RubyGems

The particular case of RubyGems (the command line tool) is that it requires to bundle inside of its code the trust certificates, which allow RubyGems to establish a connection with the servers even when base operating system is unable to verify the identity of them.

Up until a few months ago, this certificate was provided by one CA, but newer certificate is provided by a different one.

Because of this, existing installations of RubyGems would have to been updated before the switch of the certificate and give enough time for the change to spread (and people to update).

As what normally happens with software, things might get out of sync and coordinate such effort, to the size and usage of rubygems.org is almost impossible.

I've described this on Issue #1050

We had discussed also on IRC, and patches and backports were provided to all major branches of RubyGems: 1.8, 2.0, 2.2, 2.4 and 2.6

Please understand this could happen to anyone. Release multiple versions of any software in a short span of time and be very time sensitive is highly complicated.

Even if we have official releases of any of the versions that correct the issue, it will not be possible install those via RubyGems (chicken-egg problem described before).

Installing using update packages

RubyGems has covered this in the official guides, please follow the instructions here

It involves:

  • Manually downloading the latest .gem file.
  • Installing it using gem install --local
  • Run the update_rubygems command
  • Profit

You should now be able to install gems normally.

If you still experience any issue, please search for any existing issue on RubyGems Issue Tracker or report a new one.

@drbrain

This comment has been minimized.

drbrain commented Dec 2, 2014

I think we should add this to guides.rubygems.org

@takueof

This comment has been minimized.

takueof commented Dec 3, 2014

+1

@trabulmonkee

This comment has been minimized.

trabulmonkee commented Dec 3, 2014

Thanks for the insight and workaround. Just tried it out and gem installs are working now.
ruby -v
ruby 2.0.0p598 (2014-11-13) [i386-mingw32]
gem -v
2.4.5

@StevieJayCee

This comment has been minimized.

StevieJayCee commented Dec 3, 2014

You sir, are a 'gem'. Thanks muchly.

@codeodor

This comment has been minimized.

codeodor commented Dec 3, 2014

Thank you for this. Big help. ❤️ 💚 💜

@luislavena

This comment has been minimized.

Owner

luislavena commented Dec 4, 2014

@trabulmonkee please avoid RubyGems 2.4.x, as mentioned in the instructions, that version is broken on Windows.

@beauxjames

This comment has been minimized.

beauxjames commented Dec 4, 2014

Thank you...where do I send the beer?

@brunowego

This comment has been minimized.

brunowego commented Dec 4, 2014

Thanks @luislavena 😄

@jomko

This comment has been minimized.

jomko commented Dec 4, 2014

thank you!

@bdonaldharris

This comment has been minimized.

bdonaldharris commented Dec 6, 2014

THANK YOU!!!!!!!!!!!

@tsanak

This comment has been minimized.

tsanak commented Dec 7, 2014

Thank you so much!! 😃 😄

@rroman81

This comment has been minimized.

rroman81 commented Dec 9, 2014

great stuff, boy. This is definitely needs to be added to the guide.
Btw, how do i update the documentation of the already installed gems. I had to use --source http://api.rubygems.org option to get some gems while experiencing this issue.

@rmorrin

This comment has been minimized.

rmorrin commented Dec 10, 2014

Awesome stuff, fixed the issue for me too! 👍

@voku

This comment has been minimized.

voku commented Dec 10, 2014

Thx for this +1

@TImPDaley

This comment has been minimized.

TImPDaley commented Dec 11, 2014

THANK YOU VERY MUCH...

@jltemple

This comment has been minimized.

jltemple commented Dec 11, 2014

+1, +1 for adding this to the guide

@perfmoron

This comment has been minimized.

perfmoron commented Dec 12, 2014

Naice job!

@robert-toth

This comment has been minimized.

robert-toth commented Dec 12, 2014

Works like a charm. Thanks!

@jdonaldson10

This comment has been minimized.

jdonaldson10 commented Dec 13, 2014

Thanks 👍

@vtypal

This comment has been minimized.

vtypal commented Dec 13, 2014

Thank you

@nakoo

This comment has been minimized.

nakoo commented Dec 13, 2014

Thanks!

@st0le

This comment has been minimized.

st0le commented Dec 14, 2014

+1

@dlwilson88

This comment has been minimized.

dlwilson88 commented Dec 14, 2014

Yet another happy coder

@gmarini

This comment has been minimized.

gmarini commented Dec 16, 2014

Thanks! It works!

@PeterCamilleri

This comment has been minimized.

PeterCamilleri commented Dec 16, 2014

Heart filled gratitude and thanks!

@master777

This comment has been minimized.

master777 commented Dec 16, 2014

Thanks!!

@ferventcoder

This comment has been minimized.

ferventcoder commented Dec 16, 2014

👍

@tangorri

This comment has been minimized.

tangorri commented Dec 17, 2014

Thanks a lot !

@ghost

This comment has been minimized.

ghost commented Dec 17, 2014

Works great! Thanks!

@kastuart

This comment has been minimized.

kastuart commented Dec 18, 2014

Sweet baby jesus it works! You're the best!

@jethroo

This comment has been minimized.

jethroo commented Dec 18, 2014

awesome 🍸

@RichardHorton

This comment has been minimized.

RichardHorton commented Dec 18, 2014

Thank you!

@poleveD

This comment has been minimized.

poleveD commented Dec 18, 2014

Saved me lots of pain! Thank you!!

@datacoda

This comment has been minimized.

datacoda commented Dec 18, 2014

Thank you.

@omarsar

This comment has been minimized.

omarsar commented Dec 18, 2014

Worked great. Thanks for the fix!

@BenCrook

This comment has been minimized.

BenCrook commented Dec 18, 2014

Thank you!

@EtaiG

This comment has been minimized.

EtaiG commented Dec 19, 2014

Thanks - this is exactly what I needed.

Thank you also for the well written explanation!

@sharavsambuu

This comment has been minimized.

sharavsambuu commented Dec 20, 2014

cool! it work like a charm

@jjgh

This comment has been minimized.

jjgh commented Dec 20, 2014

Thanks. For some reason it was not working to me on Win7-64 until I added the "SSL_CERT_FILE" env. var with:

C:\set SSL_CERT_FILE=C:\Ruby200-x64\lib\ruby\2.0.0\rubygems\ssl_certs\AddTrustExternalCARoot-2048.pem

On a side-side-side note I'm experiencing the usual infinite CPU hog while installing rubygems darkfish documentation. This has been reported many times (at least on windows) and happens now and then with any gems... just a reminder in case someone wants something to work on ;)

@luislavena

This comment has been minimized.

Owner

luislavena commented Dec 21, 2014

Folks,

I've updated the gist to include instructions on how to manually upgrade using the released update packages.

Cheers.

@thany

This comment has been minimized.

thany commented Dec 21, 2014

Works.

Now the guys at ruby can go an incorporate this into the installer. It's quite rediculous to have to do this for every new Ruby installation.

@hmurillop

This comment has been minimized.

hmurillop commented Dec 22, 2014

Thank you so much!! i have used the Manual solution to SSL issue and it worked great!!

@architrathi

This comment has been minimized.

architrathi commented Dec 22, 2014

A big thank you! Took a lot of time to find this thread.

@krisimmig

This comment has been minimized.

krisimmig commented Dec 22, 2014

thumbs up!

@chiefy

This comment has been minimized.

chiefy commented Dec 22, 2014

👍 Windows 8.1 x64 ruby 2.0.0p481 mingw

@ghost

This comment has been minimized.

ghost commented Dec 22, 2014

Works perfectly on Windows 7 x64 with Ruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]
Thank you so much!

@Eaiman

This comment has been minimized.

Eaiman commented Dec 24, 2014

It works.
Thank you so much :)

@ClementNerma

This comment has been minimized.

ClementNerma commented Dec 24, 2014

Thank you very much !!!! 😄

@miau

This comment has been minimized.

miau commented Dec 25, 2014

I've written a dirty one-liner that do steps of "Manual solution to SSL issue". It works on Windows.
https://gist.github.com/miau/1b9eb877acb57f6c4c58

@jtlindsey

This comment has been minimized.

jtlindsey commented Dec 26, 2014

Thanks, installing using update package (new) worked for me on Win7 pro

@Alex-Fortin

This comment has been minimized.

Alex-Fortin commented Dec 28, 2014

Thanks so much. great explanation

@mikeoconnell

This comment has been minimized.

mikeoconnell commented Dec 28, 2014

Thanks for this! Back to my tutorials...

@dunake

This comment has been minimized.

dunake commented Dec 29, 2014

thank you so much

@menz1es

This comment has been minimized.

menz1es commented Dec 29, 2014

@miau your the man, that beast of a one-liner worked a treat.

@krestt

This comment has been minimized.

krestt commented Dec 30, 2014

You are the Man!! Thank you very much!

@prideloki

This comment has been minimized.

prideloki commented Dec 31, 2014

thank you

@benmathews1

This comment has been minimized.

benmathews1 commented Dec 31, 2014

Hi! I'm really really new to coding in general and pretty much everything specifically and I was following the lynda.com tutorial regarding installing Ruby on Rails until I encountered this error. Unfortunately, though I tried several times to apply the above fix, I'm still stuck! For one thing, when I click the link for the trust certificate I get a big block of text, which I think is correct, but I'm not sure how to "download" this or place it anywhere. And then in step two, when I do the "locat[ing] the directory" step a little window does appear, but it vanishes almost immediately. Past that I don't really know what to do? I've tried pasting the trust certificate text directly in the command prompt box deal, which didn't work, and I've tried opening that vanishing window again and again but it just disappears over and over. Again, I have no clue what I'm doing and I'm sure I'm making some huge ookie mistake but any advice would be greatly appreciated!! Thanks!!!

@ghost

This comment has been minimized.

ghost commented Jan 3, 2015

THANK YOU!

@mctolentino

This comment has been minimized.

mctolentino commented Jan 4, 2015

Works perfectly! Thanks for the workaround.

@trabulmonkee

This comment has been minimized.

trabulmonkee commented Jan 5, 2015

@luislavena - So updating to rubygems 2.4.x after doing this manual update is not advised, should just stay at 2.0.15? My understanding was that it was just a cert key issue which gets resolved after doing the manual update.

@nagoshiashumari

This comment has been minimized.

nagoshiashumari commented Jan 6, 2015

Thank you for this. :+1

@newbro

This comment has been minimized.

newbro commented Jan 6, 2015

Another thank you from me :D

@GeetaGh

This comment has been minimized.

GeetaGh commented Jan 6, 2015

Thank you..

@GeetaGh

This comment has been minimized.

GeetaGh commented Jan 6, 2015

Surprisingly when I installed compass for the first time, i didn't have to do anything , but while upgrading I was facing this issue. And I was completely going in wrong way, until I was your post. Thank you.

@DuongAnh

This comment has been minimized.

DuongAnh commented Jan 6, 2015

Thanks for your help ! PERFECT ^_^

@bjbussell

This comment has been minimized.

bjbussell commented Jan 6, 2015

Thanks!

@lostandfownd

This comment has been minimized.

lostandfownd commented Jan 7, 2015

Tnx , solved the problem instantly , best fix on the web

@intuedge

This comment has been minimized.

intuedge commented Jan 7, 2015

@benmathews1 -- don't click the link to open it. right-click and select save-as, and then follow the guidelines to make sure that the file you save ends up with the proper .pem extension.

@neoalvaro

This comment has been minimized.

neoalvaro commented Jan 8, 2015

Luis I got stuck in step 3 of "Manual Solution", how can I locate ssl_certs directory and copy the .pem file? on a pc windows 8? I'm a total newbie in all this programing field. thanks

@mmm13

This comment has been minimized.

mmm13 commented Jan 8, 2015

Thanks! working now..

@MikaelSmith

This comment has been minimized.

MikaelSmith commented Jan 8, 2015

Thank you so much for your work on this.

@obiora22

This comment has been minimized.

obiora22 commented Jan 9, 2015

Awesome help. Thank you!!!

@circleupx

This comment has been minimized.

circleupx commented Jan 10, 2015

Perfect 😄

@webdevilopers

This comment has been minimized.

webdevilopers commented Jan 10, 2015

👍

@TobiasAxelsson

This comment has been minimized.

TobiasAxelsson commented Jan 10, 2015

Thanks for your work on this, had problems for days but thought it was my firewall or network.
For some reason the folder is protected (win7 64 admin-rights) and the commands fail. But the manual operation worked. Thanks again!

@Limess

This comment has been minimized.

Limess commented Jan 11, 2015

Worked for me, thank you.

@dmitryvmin

This comment has been minimized.

dmitryvmin commented Jan 13, 2015

Fixed. Thank you!

@dniman

This comment has been minimized.

dniman commented Jan 15, 2015

Great job! Thanks!

@sterswift

This comment has been minimized.

sterswift commented Jan 15, 2015

thanks, man, you saved my ass

@anicething

This comment has been minimized.

anicething commented Jan 15, 2015

thans,man,you saved my ass

@webandmobilesoultion

This comment has been minimized.

webandmobilesoultion commented Jan 15, 2015

Thanks for your help.
This issue is very useful for ROR install on windows 7.
Again say "Thanks for your help luislavena! Great ,Perfectly "

@dongchen

This comment has been minimized.

dongchen commented Jan 19, 2015

Thank you. This worked for me.

@jfloff

This comment has been minimized.

jfloff commented Jan 20, 2015

👍

@yubrajpokharel

This comment has been minimized.

yubrajpokharel commented Jan 21, 2015

thats great thanks a lot

@cfetty

This comment has been minimized.

cfetty commented Jan 21, 2015

Clarification on step 2. Simply copy the new cert file to the cert directory under Ruby. For example mine was under C:\Ruby21-x64\lib\ruby\2.1.0\rubygems\ssl_certs

@UdayKumarDas

This comment has been minimized.

UdayKumarDas commented Jan 22, 2015

Thank you very much, it's really helpfull

@kyusufm

This comment has been minimized.

kyusufm commented Jan 23, 2015

Thank you so much, it's really help.

@levserk

This comment has been minimized.

levserk commented Jan 23, 2015

Thank you so much!

@yaooluu

This comment has been minimized.

yaooluu commented Jan 24, 2015

Thank you sir! Nothing can express my gratitude for your article. Thank you!!!

@watersavvy

This comment has been minimized.

watersavvy commented Jan 25, 2015

Thank you! I had to do a small modification to the process by downloading 2.2.3, then pulling the SSL Cert from that file and placing it into the original Ruby DL pack.

@vike27

This comment has been minimized.

vike27 commented Jan 26, 2015

Thank you!!!! Finally I can get back to coding!

@alkinkasap

This comment has been minimized.

alkinkasap commented Jan 26, 2015

all i can say is, That's Great! thank you..

@stephendanner

This comment has been minimized.

stephendanner commented Jan 27, 2015

Awesome! Worked perfectly on my Windoze 7 system. Thanks. Now I can get back to the Ruby on Rails intro.

@fanian

This comment has been minimized.

fanian commented Jan 28, 2015

Amazing! Thanks for your participation!

@valgreen01

This comment has been minimized.

valgreen01 commented Jan 28, 2015

Thanks a lot! it works 😀

@fikriauliya

This comment has been minimized.

fikriauliya commented Jan 29, 2015

Thanks it works 👍

@maximgatilin

This comment has been minimized.

maximgatilin commented Jan 29, 2015

Very helpful, thanks

@SleepWalker

This comment has been minimized.

SleepWalker commented Jan 30, 2015

Thanks a lot! rubygems-update worked for me

@cobyasante

This comment has been minimized.

cobyasante commented Jan 30, 2015

This should be part of the manual, in fact it should the first thing you see before you start going about installing ruby or rails
Thanks guys you have saved me a lot of headaches

@aoeasif

This comment has been minimized.

aoeasif commented Jan 31, 2015

Thanks it's works fine. 😄 :

@ifkas

This comment has been minimized.

ifkas commented Feb 1, 2015

Beautiful, works as a charm, thanks bunch!

@Landish

This comment has been minimized.

Landish commented Feb 2, 2015

I can't believe this. It finally works.
Many thanks to you @luislavena, you're my hero 😊

@ShulinChen

This comment has been minimized.

ShulinChen commented Feb 2, 2015

Thanks you so much!!!! After almost 2 hours of trying all kinds of technique, this one finally works!!Couldnt be more thankful

@chebaby

This comment has been minimized.

chebaby commented Feb 3, 2015

thank you @luislavena, it works

@charlesuko

This comment has been minimized.

charlesuko commented Feb 4, 2015

thanks so much. this worked perfectly

@rezadehganpour

This comment has been minimized.

rezadehganpour commented Feb 4, 2015

Hey Luis Thank you very much for this, However I followed all of your steps and still I have the certification problem my gem version was: 2.2.2 and with your help I upgrade that to 2.2.3. my "gem which rubygems" command return C:ror/Ruby200/lib/ruby/site_ruby/2.1.0/rubygems.rm.
When I tried to copy the .pem file that you provide in the ssl_certs file the name of the file was already exist so I replaced it! I just want to be as specific as I can so you can help me with this better!

Thanks a million!

@anisabboud

This comment has been minimized.

anisabboud commented Feb 7, 2015

Thank you!

@KabbAmine

This comment has been minimized.

KabbAmine commented Feb 7, 2015

Thank you very much 😄

@kspurgin

This comment has been minimized.

kspurgin commented Feb 9, 2015

++ thanks.

@MattForerunner

This comment has been minimized.

MattForerunner commented Feb 9, 2015

I must be really bad with computers or something but I can not get this to work for the life of me!

@MattForerunner

This comment has been minimized.

MattForerunner commented Feb 9, 2015

Thank you JESUS I GOT IT TO WORK!!!!

@sweco-seprst

This comment has been minimized.

sweco-seprst commented Feb 12, 2015

Is this suppose to also work on mac? I can't get it to work.

@prasanthkarukkuvel

This comment has been minimized.

prasanthkarukkuvel commented Feb 12, 2015

Saved my day! Thank you 😊

@anilpanthi

This comment has been minimized.

anilpanthi commented Feb 13, 2015

thanks bro

@mrwhitney

This comment has been minimized.

mrwhitney commented Feb 14, 2015

Downloaded rubygems-update-2.2.3.gem from https://github.com/rubygems/rubygems/releases/tag/v2.2.3

gem install --local ubygems-update-2.2.3.gem
#  Successfully installed rubygems-update-2.2.3

gem --version
#2.2.2

Using Git bash on Windows 7.

Edit: I missed

update_rubygems --no-ri --no-rdoc
@nipendar

This comment has been minimized.

nipendar commented Feb 15, 2015

Thank you...very nice explanation

@ghost

This comment has been minimized.

ghost commented Feb 16, 2015

Thank you very much, now I'm able to start with SASS 😂

@MickCreates

This comment has been minimized.

MickCreates commented Feb 19, 2015

This is perfect! It solved my dilemma, I thought I was going mad running around in circles trying to get a few simple gems installed but this really did the trick.

Thank you!

@Sailaja13

This comment has been minimized.

Sailaja13 commented Feb 19, 2015

Thanks a lot!

@Andrelton

This comment has been minimized.

Andrelton commented Feb 19, 2015

THANK YOU!

@ghost

This comment has been minimized.

ghost commented Feb 19, 2015

Thanks very much!!!!!!!!!!!!!!

@rashmibmanyam

This comment has been minimized.

rashmibmanyam commented Feb 20, 2015

I followed all the steps that you have mentioned, but I still see the same error. :(

@DerekFoulk

This comment has been minimized.

DerekFoulk commented Feb 20, 2015

My god. Now I can use Jekyll to build my Bootstrap. Thank you. Thank you thank you thank (a million times) thank you. This worked like a charm...

@mawwerik

This comment has been minimized.

mawwerik commented Feb 20, 2015

Thanks for this excellent description...

@RomainBrunias

This comment has been minimized.

RomainBrunias commented Feb 21, 2015

Thanks.

@harellevy

This comment has been minimized.

harellevy commented Feb 22, 2015

Thanks!!! that helped me!!

@akshitshah

This comment has been minimized.

akshitshah commented Feb 23, 2015

helped!!! rockstar you are!!!

@jansmolders86

This comment has been minimized.

jansmolders86 commented Feb 23, 2015

Thanks a bunch! 👍

@diazemiliano

This comment has been minimized.

diazemiliano commented Feb 24, 2015

Thanks! 👌

@dynamite-ready

This comment has been minimized.

dynamite-ready commented Feb 24, 2015

Can't you just add the cert to the latest installation packages, and shorten the guide above?

@hpasweden

This comment has been minimized.

hpasweden commented Feb 24, 2015

Works fine! thx

@ben-rubin

This comment has been minimized.

ben-rubin commented Feb 25, 2015

Thank you!

@SHenry77

This comment has been minimized.

SHenry77 commented Feb 25, 2015

Thank you, I was at a loss. You got me back on track.

@abdullahnaseer

This comment has been minimized.

abdullahnaseer commented Feb 25, 2015

Thank you!

@purduekenny

This comment has been minimized.

purduekenny commented Feb 25, 2015

You're the best.

@satphonix

This comment has been minimized.

satphonix commented Feb 26, 2015

Thanks, it works!

@rezwan-hossain

This comment has been minimized.

rezwan-hossain commented Feb 27, 2015

thank u its work

@wellxion

This comment has been minimized.

wellxion commented Mar 2, 2015

thx a lot. It's useful

@ghost

This comment has been minimized.

ghost commented Mar 3, 2015

+1 +1

@lenazh

This comment has been minimized.

lenazh commented Mar 3, 2015

Thank you so much!!! I hurt my head bashing it against a wall already!

@acaparrelli

This comment has been minimized.

acaparrelli commented Mar 3, 2015

thank you man!

@mohamedahmed3ali

This comment has been minimized.

mohamedahmed3ali commented Mar 4, 2015

Thanks so much

@server102

This comment has been minimized.

server102 commented Mar 4, 2015

+1... Thanks alot

@davewallace

This comment has been minimized.

davewallace commented Mar 4, 2015

+1 much appreciated.

@ghost

This comment has been minimized.

ghost commented Mar 4, 2015

To you sir, I am so very grateful. It is much appreciated. +1

@HACKVTT

This comment has been minimized.

HACKVTT commented Mar 4, 2015

Thanks, It's work for me (y)

@vegas0250

This comment has been minimized.

vegas0250 commented Mar 4, 2015

Thanks.

@richpeck

This comment has been minimized.

richpeck commented Mar 4, 2015

Thank you so much - worked a treat

@chesiljuanich

This comment has been minimized.

chesiljuanich commented Mar 5, 2015

Thank you so much !
What a big help , it works :)

@widiarifki

This comment has been minimized.

widiarifki commented Mar 5, 2015

yep, it works.

@Kcko

This comment has been minimized.

Kcko commented Mar 5, 2015

Its work 4 me. Thanx for sharing!

@pzurawski83

This comment has been minimized.

pzurawski83 commented Mar 6, 2015

awsome!!! thanks a lot

@mtrojanowski

This comment has been minimized.

mtrojanowski commented Mar 7, 2015

Thanks! 👍

@thomthom

This comment has been minimized.

thomthom commented Mar 7, 2015

Thank you very much for this detailed description and solution. 👍

@brunabxs

This comment has been minimized.

brunabxs commented Mar 7, 2015

Thanks a lot!

@vlrprbttst

This comment has been minimized.

vlrprbttst commented Mar 8, 2015

thaaaaaaaaanks

@euccas

This comment has been minimized.

euccas commented Mar 10, 2015

works perfectly. +1 thanks.

@saaqibz

This comment has been minimized.

saaqibz commented Mar 11, 2015

worked like a charm. Thanks

@ptulip

This comment has been minimized.

ptulip commented Mar 12, 2015

I'm still having problems with this...I've followed the instructions exactly and I'm still getting this (https://gist.github.com/ptulip/4c4358c8fad58f757eed) sort of error.

Any help would be much appreciated. Win7-64, ruby 2.1.5, rubygems 2.2.3

Example code I'm trying to run:

require 'open-uri'
gg = open('https://gg.com')
puts gg

@devhut

This comment has been minimized.

devhut commented Mar 13, 2015

luis for president!

@andersondsl

This comment has been minimized.

andersondsl commented Mar 16, 2015

Still Working!!! Thanks luislavena

@rbtsolis

This comment has been minimized.

rbtsolis commented Mar 18, 2015

Thank Youuuuu, Gracias me sirvio mil, ya puedo instalar la gema rhc de OpenShift, es genial 😄

@mikerentas

This comment has been minimized.

mikerentas commented Mar 18, 2015

Thank you! Excellent walkthrough, and it worked perfectly!

@KodernPl

This comment has been minimized.

KodernPl commented Mar 18, 2015

Updating gems 2.2.2 worked for me. Thank you

@nathanvda

This comment has been minimized.

nathanvda commented Mar 18, 2015

Awesome, thanks for the help! I develop on mac and deploy on windows servers, so now I can still use https://rubygems.org as the source. I recently added https://rails-assets.org because it is an incredibly easy way to include bower packages in a rails project. However: this does work on mac, but gives me the same SSL error on windows.

I installed the 2.2.3 gem. I am not sure if this is relevant or not (like: maybe it deleted the old certificate?)

Am I correct in assuming any gem-server's certificate needs to be included in the rubygems package? I am guessing they are not using the same root certificate, or it should just work. So any idea where I can find the certificate for rails-assets.org?

For now i just use http://rails-assets.org as source as a workaround.

@helloncanella

This comment has been minimized.

helloncanella commented Mar 20, 2015

Ow. Wonderful. My Christmas Gift was already brought! 😄

@thetypebeast

This comment has been minimized.

thetypebeast commented Mar 24, 2015

Tried the manual install since I have RubyGems version 2.4.x. After testing with gem install json --platform=ruby I'm still getting ERROR: Could not find a valid gem 'json' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read serve r certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

I can verify that the certificate exists in ssl_certs, and is definitely .pem file format.
I'm only using one version of ruby. So what now?

Edit: I did read the entire background and problem, but I might be missing something, since i'm just a designer trying to set this stuff up on a Windows machine so I create my prototypes using Sass, etc.

Windows 7 pro
Ruby 2.2.1p85
RubyGems 2.4.6

@phongkien

This comment has been minimized.

phongkien commented Mar 25, 2015

very nice, thanks!

@ghost

This comment has been minimized.

ghost commented Mar 25, 2015

Thank you! Nice, detailed instructions. Worked perfectly for RubyGems 2.0.14 -> 2.0.15.

@vongoh

This comment has been minimized.

vongoh commented Mar 25, 2015

Thanks! Did the trick.

Suggestion: you gave instructions under 'Installing using update packages (NEW)'.

Then right under that you gave the instructions for a Manual Install. At first glance it was confusing and made it seem like we also had to do that as well --- you might want to consider re-wording that so it is more clear to people that are simply trying to straighten this out

@maxpower720

This comment has been minimized.

maxpower720 commented Mar 25, 2015

Thanks! That did the trick!

@DeeBaker

This comment has been minimized.

DeeBaker commented Mar 27, 2015

Thank you much. Love the way you write with humor.

@TheNaoX

This comment has been minimized.

TheNaoX commented Mar 28, 2015

¡A huevo! 👍
Thank you so much!

@alecperkey

This comment has been minimized.

alecperkey commented Mar 29, 2015

For anyone who is having issues, in particular on 1.9.3 (but maybe others too):

When you do the command 'gem which rubygems'
There are two locations which I happened to mix up

C:\Ruby193\lib\ruby\1.9.1\rubygems\ssl_certs <-- incorrect
C:\Ruby193\lib\ruby\site_ruby\1.9.1\rubygems\ssl_certs <-- correct

Best,
Alec

@JimiofEden

This comment has been minimized.

JimiofEden commented Mar 31, 2015

Similar to @alecperkey, I am on ruby 2.0.0, and I had to put the ssl_certificate in:

C:\Ruby200\lib\ruby\site_ruby\2.0.0\rubygems\ssl_certs

@wilfred05777

This comment has been minimized.

wilfred05777 commented Apr 1, 2015

Wow! this make my day ! thank you for sharing!

@jumpluff

This comment has been minimized.

jumpluff commented Apr 5, 2015

Thank you so much for both the background information and the clear tutorial.

@JTallis

This comment has been minimized.

JTallis commented Apr 9, 2015

Amazing, thanks!

@bk2git

This comment has been minimized.

bk2git commented Apr 9, 2015

The solution worked for me with Ruby 1.9.3 on 32 bit Windows 7, but not with Ruby 2.2.0 on 64-bit Windows 8.1 Enterprise.

Rubygems: C:/Ruby22-x64/lib/ruby/2.2.0/rubygems.rb

I put AddTrustExternalCARoot-2048.pem in both C:\Ruby22-x64\lib\ruby\2.2.0\rubygems\ssl_certs and C:\Ruby22-x64\lib\ruby\site_ruby\2.2.0\rubygems\ssl_certs.

@kevinarrieta

This comment has been minimized.

kevinarrieta commented Apr 11, 2015

Thanks!

@mikebsg01

This comment has been minimized.

mikebsg01 commented Apr 13, 2015

Eres la leche amigo! Muchas Gracias 😃

@stickerboy

This comment has been minimized.

stickerboy commented Apr 13, 2015

Great write up, thanks! :)

@bk2git

This comment has been minimized.

bk2git commented Apr 14, 2015

Thank you. It worked for me with an older installation of Ruby. But with a new installation of Ruby on a new machine I am having this issue:

Steps: (1) Install Ruby 2.2.1 on Windows 7 x64. (2) Verify "gem --version" returns 2.4.5 (3) Verify "gem which rubygems" returns "C:/Ruby22/lib/ruby/2.2.0/rubygems.rb". (4) In Explorer, go to C:\Ruby22\lib\ruby\2.2.0\rubygems\ssl_certs. (5) Verify that "AddTrustExternalCARoot-2048.pem" already exists and that the content is the same as the content of the pem certificate in this web page's hyperlink. (6) Verify still unable to install a gem and get the SSL error. (7) Overlay the existing pem file with the pem certificate in the hyperlink of this webpage. (8) Verify gem installation returns "ERROR: While executing gem ... (OpenSSL::X509::StoreError)".

@Mikey-Lee

This comment has been minimized.

Mikey-Lee commented Apr 17, 2015

nice one !

@meysammeisam

This comment has been minimized.

meysammeisam commented Apr 19, 2015

the same issue as @bk2git (2 comments upper) :

ubuntu 12.04 32bit,
gem --version => "2.4.5"
gem which rubygems => ".rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems.rb"
...

@iconcells

This comment has been minimized.

iconcells commented Apr 19, 2015

copy the .pem file actually solved the problem. Wonder why that was not being fixed in the installer in the first place for Windows. Thanks a lot.

@mlb5000

This comment has been minimized.

mlb5000 commented Apr 27, 2015

.pem file workout does not work for RubyInstaller - Ruby 2.2.2 x64 - Windows 8.1

ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]

gem --version
2.4.5

Even downloading the latest rubygems gem and installing it doesn't work.

@mlb5000

This comment has been minimized.

mlb5000 commented Apr 27, 2015

Same problem with 2.1.6 32-bit.

@osdk

This comment has been minimized.

osdk commented Apr 29, 2015

It solved my problem... thanks

@MattCordell

This comment has been minimized.

MattCordell commented May 2, 2015

Thankyou. This is my first foray into Ruby, and you saved me a lot of pain.

@BahiHussein

This comment has been minimized.

BahiHussein commented May 2, 2015

Thank You. saved my day

@bk2git

This comment has been minimized.

bk2git commented May 7, 2015

@mlb5000. See same problem. Could the cause be related to 64-bit Windows OS? I see the problem on Windows 7 b4 bit and Windows 8.1 64 bit. I do not see the problem on Windows 7 32 bit.

@gaurav-lad

This comment has been minimized.

gaurav-lad commented May 11, 2015

Thank you. luislavena

@raoprashanth007

This comment has been minimized.

raoprashanth007 commented May 11, 2015

Thanks, It worked for me too

@StevenBR

This comment has been minimized.

StevenBR commented May 12, 2015

Worked here on windows 10 tech 64-bit. Thank you!

@flightofthunder

This comment has been minimized.

flightofthunder commented May 13, 2015

Worked on Windows 7 64-bit. Fantastic, thank you very much

@saske505

This comment has been minimized.

saske505 commented May 16, 2015

Thanks you so much, windows 7 32bit

@TomDeFrank

This comment has been minimized.

TomDeFrank commented May 17, 2015

Windows 8.fix not working.
.pem file wad already present in ssl folder

@varundmishra

This comment has been minimized.

varundmishra commented May 19, 2015

@TomDeFrank : You are right, the fix ain't working for Windows 8.1 64 bit (Ruby 2.2.x)
Try uninstalling 2.2.x and install 2.1.6 (32 bit) with relevant DevKit, works for me.

@nollenr

This comment has been minimized.

nollenr commented May 20, 2015

Fix not working for Linux (Centos 2.6.32-504.16.2.el6.i686)
[root@renoir ssl_certs]# ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [i686-linux]
[root@renoir ssl_certs]# gem -v
2.4.7

AddTrustExternalCARoot-2048.pem is current and matches

@linf2

This comment has been minimized.

linf2 commented May 23, 2015

Omg thank you.

@moicarolyn

This comment has been minimized.

moicarolyn commented May 27, 2015

Thank you!!!!

@DenisLemos

This comment has been minimized.

DenisLemos commented May 28, 2015

Thank you sir. You are a gentlemen and a scholar ಠ_ರೃ

@fernandoGN

This comment has been minimized.

fernandoGN commented May 28, 2015

In my case the solution was to use the proxy:

gem install --http-proxy http://ip:port jekyll
@patrickst1

This comment has been minimized.

patrickst1 commented Jun 3, 2015

Excellent, Thank you!!

@Bela2711

This comment has been minimized.

Bela2711 commented Jun 6, 2015

Thanks, it helped! :)

@abbondanza

This comment has been minimized.

abbondanza commented Jun 9, 2015

Great stuff! Truly helpful.. Will share with others where I work

@Visionaire

This comment has been minimized.

Visionaire commented Jun 10, 2015

Thank you, that was helpfull and right to the point! 😊

@prinok7

This comment has been minimized.

prinok7 commented Jun 14, 2015

Respect Man! you really are one BIG Gem of a guru! it worked !!! been labouring for days now,until you showed up.thanks a million.keep up the good work and more gems to your fingers and brain!

@wyrdathru

This comment has been minimized.

wyrdathru commented Jun 17, 2015

For those having issues on Windows 8.1 64-bit, try https://gist.github.com/fnichol/867550.

You'll need to uninstall Ruby 2.2 (or whatever) from Control Panel and download the RailsInstaller package, then follow the steps outlined.

Make sure you add your environment variable, not just use 'set' from the command line.

@dapperAuteur

This comment has been minimized.

dapperAuteur commented Jun 18, 2015

you're my new favorite developer. I wonder what your rookie card is worth!?

@ArsenalofCode

This comment has been minimized.

ArsenalofCode commented Jun 20, 2015

you are possibly the greatest human i have ever encountered on the internet world.

thank you.

@evanweking

This comment has been minimized.

evanweking commented Jun 24, 2015

thanks you very much,,, one more thing,, is installing gems rails is taking a long time or not?? thank you

@GuinetPro

This comment has been minimized.

GuinetPro commented Jun 26, 2015

MUCHAS GRACIAS!!!!!

@compajl50

This comment has been minimized.

compajl50 commented Jun 28, 2015

Thank you for explaining background is very helpful. Having old installations of gems and rails on Windows 64bit machines.

@taragano

This comment has been minimized.

taragano commented Jun 29, 2015

Amazing! Thank you :)

@A-Nasser

This comment has been minimized.

A-Nasser commented Jun 30, 2015

Thanks a lot, working gr8.

@fschwiet

This comment has been minimized.

fschwiet commented Jul 1, 2015

I had a different issue, using Vagrant on Windows it turns out a recent change to the ffi gem causes problems that report the same problem (SSL cert failed). In case others are in the same boat, I thought I'd link the solution that finally worked for me (installing vagrant plugin ffi version 1.9.8) at: http://stackoverflow.com/questions/31106397/first-vagrant-up-works-but-then-ruby-error-after-halt-up/31121287#31121287

@helltone

This comment has been minimized.

helltone commented Jul 2, 2015

done it!

@realvjy

This comment has been minimized.

realvjy commented Jul 6, 2015

It works.
Thanks !!

@hunj

This comment has been minimized.

hunj commented Jul 9, 2015

It works!
Thank you :)

@paratagas

This comment has been minimized.

paratagas commented Jul 9, 2015

Thank you, man, great explanation!

@haryantowang09

This comment has been minimized.

haryantowang09 commented Jul 10, 2015

This is super amazing ! I tried the manual way, works like guessing 1+1 = 2.

@antoniomerlin

This comment has been minimized.

antoniomerlin commented Jul 11, 2015

ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]
gem -v : 2.3.0
Rails 4.2.3

I've tried the above steps but getting following issue Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/gems/minit est-5.7.0.gem) An error occurred while installing minitest (5.7.0), and Bundler cannot continue. Make sure that `gem install minitest -v '5.7.0'` succeeds before bundling.

@LucasServare

This comment has been minimized.

LucasServare commented Jul 12, 2015

Exactly what I was looking for, thank you very much!

@thepulkitagarwal

This comment has been minimized.

thepulkitagarwal commented Jul 15, 2015

Worked like a charm! Thank You :)

@coirewalker

This comment has been minimized.

coirewalker commented Jul 19, 2015

In this section:
==== Installing using update packages (NEW) ===

I am stuck. In the last step (the uninstall) I received the following prompt, not in this tutorial:
$ gem uninstall rubygems-update
Remove executables:
update_rubygems

in addition to the gem? [Yn] n
Executables and scripts will remain installed.
Successfully uninstalled rubygems-update-2.2.3
$ gem uninstall rubygems-update
$ "

There is a blank prompt on this last line, so if I was supposed to enter "Y" there doesn't seem to be way to do so. Sorry if I missed something obvious--I'm new to this stuff and been at it for 10hrs straight now haha.

Please advise. Thanks.

@eyecatchup

This comment has been minimized.

eyecatchup commented Jul 29, 2015

There's one more solution which is actually the easiest and will work 100%: change the default source from https:// to http://. (Of course, this is not the recommended solution.)

See: https://gist.github.com/eyecatchup/20a494dff3094059d71d#solution-1-change-default-source-host-from-https-to-http

@parthibd

This comment has been minimized.

parthibd commented Jul 30, 2015

I encountered this error initially when installing the Ruby 2.0 version of railsinstaller . After doing a "gem update --system" everything is working as it should .

@joncepeda

This comment has been minimized.

joncepeda commented Aug 3, 2015

saves my time! 👍

@felnder7

This comment has been minimized.

felnder7 commented Aug 12, 2015

Thanks a lot !!!!!!!! :-)

@dfmedrano

This comment has been minimized.

dfmedrano commented Aug 18, 2015

I've tried all that is written in this gist but I still have the same error. I cannot update or install gems. Any Ideas?
Initially I had rubygems version 2.4.6, I downgraded to 2.2.3 so when I type gem --version I get 2.2.3
My Ruby version is 1.9.3p237
I copied and pasted the certificate file manually but I still get the error
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certif
icate verify failed (https://rubygems.global.ssl.fastly.net/specs.4.8.gz)

Any ideas will be greatly appreciated!

@tonkec

This comment has been minimized.

tonkec commented Aug 26, 2015

Finally a solution! Thank you 👍

@wlawbr

This comment has been minimized.

wlawbr commented Aug 27, 2015

FWIW this solution will also need to be applied for those behind proxies that do SSL Decrypt (aka Man In The Middle).

The reason for this is that of the requests that are made, two use the TLS SNI headers, but there are two that are made to the CDN that do not include the SNI headers. As a result this makes it really hard to put in MITM bypasses - rubygems.org, api.rubygems.org, and rubygems.global.ssl.fastly.net are already listed and work fine. As a CDN is in use, admins can't just go putting in blocks of IP's to the bypass lists as other content would then be excepted as well.

Just place the proxy's root CA cert in the ssl_certs directory and off you go.

For reference, those using ChefDK 0.7.0 the directory is here:
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/ssl_certs

@KhanMaytok

This comment has been minimized.

KhanMaytok commented Aug 28, 2015

Many thanks!

@irkanu

This comment has been minimized.

irkanu commented Aug 28, 2015

+1

@tibsar

This comment has been minimized.

tibsar commented Aug 29, 2015

Thank you!

@DanM2010

This comment has been minimized.

DanM2010 commented Sep 4, 2015

Thank you!

@shashwat51

This comment has been minimized.

shashwat51 commented Sep 4, 2015

Thanks a ton

@salihozd

This comment has been minimized.

salihozd commented Sep 6, 2015

Thank you, "Installing using update packages" worked for me.

@mcmonkeys1

This comment has been minimized.

mcmonkeys1 commented Sep 9, 2015

Woo! Thanks you!

@mikapa

This comment has been minimized.

mikapa commented Sep 13, 2015

+1 from me, too! Thanks!

@ghost

This comment has been minimized.

ghost commented Sep 15, 2015

+1 This page is a life server!

@czujnik81

This comment has been minimized.

czujnik81 commented Sep 15, 2015

+1 Thanks Man - it saved me lot's of time! Great job

@LAGRANJ

This comment has been minimized.

LAGRANJ commented Sep 18, 2015

thanks!

@BWoodfork

This comment has been minimized.

BWoodfork commented Sep 18, 2015

I ran into the issue of the listed rubygem-update gem files in this gist, being older than the version that I was running. Below is the link to the newest versions.

The .gem file's for the latest versions of rubygems-update can be found here: https://rubygems.org/gems/rubygems-update/versions

@jhabib

This comment has been minimized.

jhabib commented Sep 20, 2015

Thank you!

@joriq

This comment has been minimized.

joriq commented Sep 20, 2015

Thank you very much! Everything is working fine now.

@TaylorHuston

This comment has been minimized.

TaylorHuston commented Sep 21, 2015

Kind of random. I did this workaround a while ago, works great, can still install and update gems all day long.

Except for one project. It's a JekyllRB project, not a Rails one, but it has a Gemfile and I am getting the SSL error from with it. All other projects on my machine seem to be working fine.