Create a gist now

Instantly share code, notes, and snippets.

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

SSL upgrades on 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.


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 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.


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 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 commented Dec 2, 2014

I think we should add this to

takueof 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

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

codeodor commented Dec 3, 2014

Thank you for this. Big help. ❀️ πŸ’š πŸ’œ


luislavena commented Dec 4, 2014

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

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

Thanks @luislavena πŸ˜„

jomko commented Dec 4, 2014

thank you!

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

tsanak commented Dec 7, 2014

Thank you so much!! πŸ˜ƒ πŸ˜„

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 option to get some gems while experiencing this issue.

rmorrin commented Dec 10, 2014

Awesome stuff, fixed the issue for me too! πŸ‘

voku commented Dec 10, 2014

Thx for this +1


+1, +1 for adding this to the guide

Naice job!

Works like a charm. Thanks!

Thanks πŸ‘

vtypal commented Dec 13, 2014

Thank you

nakoo commented Dec 13, 2014


st0le commented Dec 14, 2014


Yet another happy coder

gmarini commented Dec 16, 2014

Thanks! It works!

Heart filled gratitude and thanks!



Thanks a lot !

cusnar commented Dec 17, 2014

Works great! Thanks!

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

jethroo commented Dec 18, 2014

awesome 🍸

Thank you!

poleveD commented Dec 18, 2014

Saved me lots of pain! Thank you!!

Thank you.

omarsar commented Dec 18, 2014

Worked great. Thanks for the fix!

Thank you!

EtaiG commented Dec 19, 2014

Thanks - this is exactly what I needed.

Thank you also for the well written explanation!

cool! it work like a charm

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 commented Dec 21, 2014


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


thany commented Dec 21, 2014


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.

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

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

thumbs up!

chiefy commented Dec 22, 2014

πŸ‘ Windows 8.1 x64 ruby 2.0.0p481 mingw


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 commented Dec 24, 2014

It works.
Thank you so much :)

Thank you very much !!!! πŸ˜„

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.

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

Thanks so much. great explanation

Thanks for this! Back to my tutorials...

dunake commented Dec 29, 2014

thank you so much

menz1es commented Dec 29, 2014

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

krestt commented Dec 30, 2014

You are the Man!! Thank you very much!

thank you

Hi! I'm really really new to coding in general and pretty much everything specifically and I was following the 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 commented Jan 3, 2015


Works perfectly! Thanks for the workaround.

@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.

Thank you for this. :+1

newbro commented Jan 6, 2015

Another thank you from me :D

GeetaGh commented Jan 6, 2015

Thank you..

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 commented Jan 6, 2015

Thanks for your help ! PERFECT ^_^


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

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.

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 commented Jan 8, 2015

Thanks! working now..

Thank you so much for your work on this.

obiora22 commented Jan 9, 2015

Awesome help. Thank you!!!

Perfect πŸ˜„


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 commented Jan 11, 2015

Worked for me, thank you.

Fixed. Thank you!

dniman commented Jan 15, 2015

Great job! Thanks!

thanks, man, you saved my ass

thans,man,you saved my ass

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

Thank you. This worked for me.

jfloff commented Jan 20, 2015


thats great thanks a lot

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

Thank you very much, it's really helpfull

kyusufm commented Jan 23, 2015

Thank you so much, it's really help.

levserk commented Jan 23, 2015

Thank you so much!

yaooluu commented Jan 24, 2015

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

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 commented Jan 26, 2015

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

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

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

fanian commented Jan 28, 2015

Amazing! Thanks for your participation!

Thanks a lot! it works πŸ˜€

Thanks it works πŸ‘

Very helpful, thanks

Thanks a lot! rubygems-update worked for me

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 commented Jan 31, 2015

Thanks it's works fine. πŸ˜„ :

ifkas commented Feb 1, 2015

Beautiful, works as a charm, thanks bunch!

Landish commented Feb 2, 2015

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

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

chebaby commented Feb 3, 2015

thank you @luislavena, it works

thanks so much. this worked perfectly

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!

Thank you!

Thank you very much πŸ˜„

kspurgin commented Feb 9, 2015

++ thanks.

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

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

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

Saved my day! Thank you 😊

thanks bro

Downloaded rubygems-update-2.2.3.gem from

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

gem --version

Using Git bash on Windows 7.

Edit: I missed

update_rubygems --no-ri --no-rdoc

Thank you...very nice explanation


ghost commented Feb 16, 2015

Thank you very much, now I'm able to start with SASS πŸ˜‚

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!

Thanks a lot!



ghost commented Feb 19, 2015

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

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

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...

Thanks for this excellent description...


Thanks!!! that helped me!!

helped!!! rockstar you are!!!

Thanks a bunch! πŸ‘

Thanks! πŸ‘Œ

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

Works fine! thx

Thank you!

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

Thank you!

You're the best.

Thanks, it works!

thank u its work

wellxion commented Mar 2, 2015

thx a lot. It's useful


ghost commented Mar 3, 2015

+1 +1

lenazh commented Mar 3, 2015

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

thank you man!

Thanks so much

+1... Thanks alot

+1 much appreciated.


ghost commented Mar 4, 2015

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

HACKVTT commented Mar 4, 2015

Thanks, It's work for me (y)


richpeck commented Mar 4, 2015

Thank you so much - worked a treat

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

yep, it works.

Kcko commented Mar 5, 2015

Its work 4 me. Thanx for sharing!

awsome!!! thanks a lot

Thanks! πŸ‘

thomthom commented Mar 7, 2015

Thank you very much for this detailed description and solution. πŸ‘

brunabxs commented Mar 7, 2015

Thanks a lot!


euccas commented Mar 10, 2015

works perfectly. +1 thanks.

saaqibz commented Mar 11, 2015

worked like a charm. Thanks

I'm still having problems with this...I've followed the instructions exactly and I'm still getting this ( 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('')
puts gg

devhut commented Mar 13, 2015

luis for president!

Still Working!!! Thanks luislavena

Thank Youuuuu, Gracias me sirvio mil, ya puedo instalar la gema rhc de OpenShift, es genial πŸ˜„

Thank you! Excellent walkthrough, and it worked perfectly!

Updating gems 2.2.2 worked for me. Thank you

Awesome, thanks for the help! I develop on mac and deploy on windows servers, so now I can still use as the source. I recently added 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

For now i just use as source as a workaround.

Ow. Wonderful. My Christmas Gift was already brought! πŸ˜„

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 - SSL_connect returned=1 errno=0 state=SSLv3 read serve r certificate B: certificate verify failed (

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

very nice, thanks!

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

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

Thanks! That did the trick!

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

TheNaoX commented Mar 28, 2015

Β‘A huevo! πŸ‘
Thank you so much!

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


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


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

jumpluff commented Apr 5, 2015

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

JTallis commented Apr 9, 2015

Amazing, thanks!

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.


Eres la leche amigo! Muchas Gracias πŸ˜ƒ

Great write up, thanks! :)

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)".

nice one !

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"

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 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

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

mlb5000 commented Apr 27, 2015

Same problem with 2.1.6 32-bit.

osdk commented Apr 29, 2015

It solved my problem... thanks

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

Thank You. saved my day

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.

Thank you. luislavena

Thanks, It worked for me too

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

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

Thanks you so much, windows 7 32bit

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

@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 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

AddTrustExternalCARoot-2048.pem is current and matches

linf2 commented May 23, 2015

Omg thank you.

Thank you!!!!

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

In my case the solution was to use the proxy:

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

Excellent, Thank you!!

Bela2711 commented Jun 6, 2015

Thanks, it helped! :)

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

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

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!

For those having issues on Windows 8.1 64-bit, try

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.

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

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

thank you.

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


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

Amazing! Thank you :)

Thanks a lot, working gr8.

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:

helltone commented Jul 2, 2015

done it!

realvjy commented Jul 6, 2015

It works.
Thanks !!

hunj commented Jul 9, 2015

It works!
Thank you :)

Thank you, man, great explanation!

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

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 ( 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.

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

Worked like a charm! Thank You :)

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:

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.

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.)


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 .

saves my time! πŸ‘

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

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 (

Any ideas will be greatly appreciated!

tonkec commented Aug 26, 2015

Finally a solution! Thank you πŸ‘

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 -,, and 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:

Many thanks!

irkanu commented Aug 28, 2015


tibsar commented Aug 29, 2015

Thank you!

DanM2010 commented Sep 4, 2015

Thank you!

Thanks a ton

salihozd commented Sep 6, 2015

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

Woo! Thanks you!

mikapa commented Sep 13, 2015

+1 from me, too! Thanks!


ghost commented Sep 15, 2015

+1 This page is a life server!

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

LAGRANJ 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:

jhabib commented Sep 20, 2015

Thank you!

joriq commented Sep 20, 2015

Thank you very much! Everything is working fine now.

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.


Seytom commented Sep 24, 2015

Was going to save the .pem file in my rubygems/sslcertificates folder, but it was already there. Not the answer for me, unfortunately.

zayro commented Sep 28, 2015

Oye Gracias muy Bueno


ghost commented Sep 29, 2015

It worked. Thaks. But i got 2.1.5 version of Ruby, is it applicable for the course?

lumagm commented Sep 29, 2015

awesome 🍸

Thank You !

surbey commented Oct 8, 2015

Thank you

Thank you

I am new to Ruby but just need to run this:

Can anyone help me get this running?

Directory of C:\OTPPB2015\Workspace\Ruby

10/09/2015 01:20 PM

10/09/2015 01:20 PM ..
10/09/2015 11:07 AM 18 hello.rb
10/09/2015 12:58 PM octokit
09/24/2015 09:35 AM 2,182 octokit.rb
10/09/2015 12:57 PM 2,447 team_audit.rb
3 File(s) 4,647 bytes
3 Dir(s) 273,722,306,560 bytes free

C:\OTPPB2015\Workspace\Ruby>ruby team_audit.rb
C:/Tools/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- octokit/client (LoadError) from C:/Tools/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from C:/OTPPB2015/Workspace/Ruby/octokit.rb:1:in <top (required)>' from team_audit.rb:13:inrequire_relative'
from team_audit.rb:13:in `


C:\Users\huj\Desktop>ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32]

C:\Users\huj\Desktop>gem -v

C:\Users\huj\Desktop>gem install octokit
ERROR: Could not find a valid gem 'octokit' (>= 0), here is why:
Unable to download data from - SSL_connect returned=1 errno=0 state=
SSLv3 read server certificate B: certificate verify failed (

Great. many thanks~! I think that a newbie to Ruby should check this first before Rails installation.

Thank you! I believe it will work

Beatt commented Oct 11, 2015

Thanks dude!

I can run "gem install octokit" at a home pc without any issue, but always get this ssl cert error at a company pc, no matter which version I use and this solution also doesn't help.

Try updating your gem sources:

gem source -r
gem source -a
gem update --system

Cool Buddy.........Its amazing!

Hi Luislavena,
Thank you very much for this tutorial.
It helps solved my rails updating issue.


Magic Darts. I cannot say thank you enough.

The more this becomes visible the better. Boomshanka

enk4 commented Oct 21, 2015


help me solved 'bundle install' things

cuong2k commented Oct 22, 2015

Hi Luislavena,

support case bundle install fluentd error (centos 6.7 64bit):
bundle install

Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for
all non-root users on this machine.
Fetching gem metadata from
Fetching version metadata from
Resolving dependencies...
Using rake 10.4.2

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

[root@localhost ]# ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
[root@localhost ]# gem -v

help me solved !
Thanks ,

Thanks a lot buddy ..

mcgfv commented Oct 22, 2015

THANKSSSSS!!!! Finally it works!!!!! HURRAAA!!!


andsild commented Oct 30, 2015

Another thanks from me :)

Worked great on Windows 10. Thanks.

Thank you so much! Nice going.

tatthien commented Nov 9, 2015

Awesome! It works like a charm

Rushell commented Nov 9, 2015

Smoooth ;)
Thanks a lot. πŸ‘

Excelent!!! Thanks you so much!!!

got all the way through, then tried the 'gem install sass' again and got the SSL same error again!.. I am using a Citrix VM machine with Windows 7, would this be an issue?

@chrisbean33, I'm with you. I have Windows 7, RubyGems, and Ruby 2.2.3p173 (2015-08-18 revision 51636) [x64-mingw32].

The problem still persists for me.

Correction: @doctopus219's suggestion helped me resolve the issue, though I am connecting without a secure connection.

Thank you!

Nice one, thanks - a big help.

Thank you! +1

gracias !!

Thanks !!

I am facing same error when tried to payment SagePay Gateway
Error: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Anybody have idea?

horror commented Nov 26, 2015

now im your slave! thx!

Menniti commented Nov 29, 2015

Yeah, you are rock! thanks!

It works like a charm. Thank you!

Thank you so much :'))))))

lenhoy commented Dec 9, 2015

My only experience with rails is from codeacademy, and even I managed to do this workaround! Great guide!


RSchul2 commented Dec 16, 2015

thank you!

yadoik commented Dec 18, 2015


veevax commented Dec 21, 2015


Aravin commented Dec 23, 2015

Useful Info :)

krishta commented Dec 25, 2015

Thanks πŸ‘

Simply +1 πŸ‘

Thanks. Love the solution. It works.

mycql commented Jan 5, 2016

Worked flawlessly with ruby on mingw. Thanks!

It worked, Bundle of thanx πŸ‘ :)

xal0do0x commented Jan 8, 2016

Thanks you very much! You are a real gem :)

Zarkys commented Jan 10, 2016

Excelente, realmente ΓΊtil, me funciono el paquete de actualizaciΓ³n.

Thank You!!!!

Thank you! It works.


ghost commented Jan 19, 2016

But in that directory i already have a file with the same name as the one i downloaded.

Thank you so much!!!

how to solve in ruby ver 4.2.4?

Mehn you rock!!!!!!!!!!!!

Thanks you!!! Easy, straight-forward, and to the point!

smosab commented Feb 10, 2016

Perfect. Thank you!

Thanks for the post! I did some editing of the article to improve grammar and readability.

bundle of thanks! love you dear πŸ‘

pjs2005 commented Feb 16, 2016

Thank you

In my situation, the problem was caused by file permission problems. The user didn't have read permissions on the new .pem files. (I'm on openSuSE 42.1 though)

πŸ‘ for this tutorial

you are a blessing..............

DaveRGP commented Mar 7, 2016

Fantastic, totally works. Needed this to try and sort out a jekyll installation.

Potentially worth noting: If the rubygems-update-2.0.15 is installed, it will work fine for ruby version 2.0.14.

Life saving! Thx!

Never got the fix above to work but was successful with the following:

Windows 7 64bit
Ruby installer Ruby 2.2.4 (x64)
Ruby Dev Kit DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

After installing, Download the cacert.pem file from Save this file to output of the command: gem which rubygems + ssl_cert. For me this was: C:\Ruby22-x64\lib\ruby\2.2.0\rubygems\ssl_certs.

Last create a environment variable called "SSL_CERT_FILE" with a value to the cert file you downloaded, mine would be: "C:\Ruby22-x64\lib\ruby\2.2.0\rubygems\ssl_certs\cacert.pem"

I had to close and reopen my Eclipse with Aptana plugin to pickup the new environment variable.

Credit to the following post that is similar:

草ζ³₯ι©¬ηš„rubyοΌŒζŠ˜θ…Ύζ­»δΊΊηš„SSL_connect certificate verify failed]
^^^__you can see detail

i recommend u install local β€”β€”β€”β€”β€”β€”β€”β€”
gem install --local ___your file path(of gem file)

With Ruby 2.2.3p173 and gem 2.4.5 on Windows 8.1 (x64), just manually adding the updated certificate DID work for me.

But on Windows 10 using the same Ruby 2.2.3p173 and gem 2.4.5, manually adding the updated cert did NOT work. I had to update 'rubygems' to version 2.4.8 using the rubygems-update mechanism outlined above.

I found the correct rubygems-update gem file here:

I've also written up an explanation of these issues with a simple guide for resolving the RubyGems SLL and certificate issues.

The certificate download link is broken. []

No certificate file found.

jjgh commented May 2, 2016

Win 7 64bit.

What I don't understand is, why am I getting again this error after uninstalling Ruby 2.2, freshly installing Ruby 2.3, and updating Rubygems to v. 2.6.4 (with gem update --system)? Also, the Rubygems version shipped with Ruby 2.3 should be immune from this error already, shouldn't it?
Since the .pem file is already present in both C:\Ruby23-x64\lib\ruby\site_ruby\2.3.0\rubygems\ssl_certs\ and C:\Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs, then why is it not working and still showing the SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed error message?

nkuligoski commented May 17, 2016

@jjgh I am also on Windows 7. Although, I am running ruby 2.2.4p230, I am still receiving the same errors as you. Have you been able to find a fix?

Edit: A fresh install of ruby does not change anything. Still currently unable to download the cert from the link above. (not found)

Thank you πŸ‘

If you're like me and none of the above approaches resolved the issue, try this option which I found on stackoverlow.

Replace the ssl gem source with non-ssl as a temp solution:
gem sources -r
gem sources -a

shweta-sah commented Jun 16, 2016

If this pem doesn't work, try and follow the manual way to get the cacert.pem file

RAZAW commented Jun 27, 2016

Many thanks!

sudogem commented Jun 27, 2016

The download link above ( is broken :(

So to those who are looking for the certificate file I put it in gist []
I copied the cert file in my directory which is C:\Ruby215\lib\ruby\2.1.0\rubygems\ssl_certs
Now I can do $ gem install bundler and it works great!!

My setup:

C:\>ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]
C:\>gem --version
C:\>gem env
RubyGems Environment:
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby215/lib/ruby/gems/2.1.0
  - RUBY EXECUTABLE: C:/Ruby215/bin/ruby.exe
  - SPEC CACHE DIRECTORY: C:/Users/armano/.gem/specs
    - ruby
    - x86-mingw32
     - C:/Ruby215/lib/ruby/gems/2.1.0
     - C:/Users/armano/.gem/ruby/2.1.0
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-document"

lluis commented Jul 7, 2016

thanks @sudogem!

@luislavena. Thanks for the workaround. It seems to work with RubyGems 1.8. But for some reasons, I need to use 2.2. It doesn't work. When I update to 1.8, I see the changelog in console as

== 1.8.30 / 2014-12-21

Bug fixes:

  • Backport: Add alternate Root CA for upcoming certificate change.
    Fixes #1050 by Protosac

but it is missing in 2.2. etc. I have really been stuck at this.

toadle commented Aug 23, 2016

I think this is fixable much more easy. See this

ChicasFootball commented Oct 5, 2016

Still struggling when I try and obtain a new trust certificate I get "404: Not Found".

gem version is 2.5.1
ruby version - ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

I thought to this point I had followed the instructions pretty well but it's not looking good now :(. Any thoughts?

Found another source and problem seems to be resolved now

@ChicasFootball can you point us to this resource?

panatl commented Oct 5, 2016

@ChicasFootball did you resolved this on >= 2.2.2? Can you please care to share?i am having this on Ubuntu 14

timo002 commented Oct 5, 2016

Running on OSX 10.11.6 (El Capitan). Same issue here.
Using vagrant for local development and since today my vagrant provision command is failing on:
Unable to download data from - SSL_connect returned=1 errno=0 state=error: certificate verify failed (

Solutions mentioned in this thread don't seem to work.
gem version: 2.4.5
ruby version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

@toadle's answer (23 August) worked for me. Follow the link to his comprehensive blog post. Short story: set environment variable SSL_CERT_DIR to /mingw64/ssl/certs, and SSL_CERT_FILE to /mingw64/ssl/cert.pem.
Easy in bash but I'm using PowerShell (just to make it harder) so envt vars get set in System -> Advanced system settings -> Environment variables. And the PowerShell command to list environment variables is Get-ChildItem Env:.

prewk commented Oct 6, 2016

@timo002 You're not alone, please write here if you find a solution.

Update: Our PuPHPet based vagrant boxed solved the problem in this commit:

pavkhural commented Oct 6, 2016

@prewk The following worked for me for CI build agents running on WIndows Server 2012 R2, the 2 Environment variables can be added via PowerShell

[System.Environment]::SetEnvironmentVariable("SSL_CERT_DIR", "C:\Program Files\Git\mingw64\ssl\certs", "Machine")


[System.Environment]::SetEnvironmentVariable("SSL_CERT_FILE", "C:\Program Files\Git\mingw64\ssl\cert.pem", "Machine")

replace mingw64 wth mingw32 if using the 32 bit version of Git

elrob commented Oct 6, 2016

I've managed to fix this on our build machine. I've automated the installation of git bash and the updating of the SSL environment variables.

Run this as a powershell script:

& wget -OutFile git-for-windows.exe
Start-Process ./git-for-windows.exe -Wait -ArgumentList "/silent"
[Environment]::SetEnvironmentVariable("SSL_CERT_DIR", "C:/opt/git/mingw64/ssl/certs", "Machine")
[Environment]::SetEnvironmentVariable("SSL_CERT_FILE", "C:/opt/git/mingw64/ssl/cert.pem", "Machine")
$env:SSL_CERT_DIR = [System.Environment]::GetEnvironmentVariable("SSL_CERT_DIR","Machine")
$env:SSL_CERT_FILE = [System.Environment]::GetEnvironmentVariable("SSL_CERT_FILE","Machine")

mondaini commented Oct 6, 2016

The link to the trust certificate is down 😒

Link for trust certificate does not work.

Also your will need to reboot your machine / server after adding the environment variables for the rubygems install / update to work

I just installed the most recent release of Ruby for Windows which, apparently, comes with gem 2.5.1 and I'm getting this same error trying to install svn2git. Is this a problem with the gem application itself or a problem with a server. What's the fix? I apologize but I'm having a tough time getting through the weeds here and, per the tutorial, it looks like this issue should've been cleared up a long time ago.

Thanks in advance!

binki commented Oct 6, 2016

Why doesn’t modern ruby for windows distro come with GlobalSignRootCA.pem? Garr, this is such a pain to manually do on every install. Because the link is broken, I just used SeaMonkey’s export tool to export the GlobalSign Root CA (serial number 04:00:00:00:00:01:15:4B:5A:C3:94) to a PEM file (you should be able to do this somewhere in the Options menu of anything Mozilla-based) and copied that to the ssl_certs directory. I guess at least you don’t have to do anything like run a magical β€œregister this cert” command, so it was actually quite straightforward. And this guide is still useful even if the cert it points to is wrong.

Link to the trust certificate seems to be down.

404: Not Found

raoel commented Oct 7, 2016

windows 10, 64 bit, anniversary update

I tried both solutions with 2.0, 2.2, 2.4, no luck...

To get the certificate I used the one-liner miau provided, the certificate shows up in explorer in the correct folder, so that seems to be OK.

Still I'm getting this:

ERROR: Could not find a valid gem 'compass' (>= 0), here is why:
Unable to download data from - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

C:\Users\raoel>gem --version

C:\Users\raoel>where ruby

C:\Users\raoel>gem install --local d:\rubygems-update-2.2.3.gem
Successfully installed rubygems-update-2.2.3
Parsing documentation for rubygems-update-2.2.3
Installing ri documentation for rubygems-update-2.2.3
Done installing documentation for rubygems-update after 0 seconds
1 gem installed

C:\Users\raoel>update_rubygems --no-ri --no-rdoc
RubyGems 2.2.3 installed


RubyGems installed the following executables:

C:\Users\raoel>gem --version

C:\Users\raoel>gem uninstall rubygems-update -x
Removing update_rubygems
Successfully uninstalled rubygems-update-2.2.3

C:\Users\raoel>gem --version

C:\Users\raoel>gem install compass
ERROR:  Could not find a valid gem 'compass' (>= 0), here is why:
          Unable to download data from - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

YetiCGN commented Oct 7, 2016

Yes, can't download either!

raoel commented Oct 7, 2016

@binki now you are my hero :-)

Download here:

Convert to PEM on some random website ()

Copy to:

alexharv074 commented Oct 7, 2016

I did this:

To workaround the link being down:

$ curl -o AddTrustExternalCARoot-2048.pem
$ mv AddTrustExternalCARoot-2048.pem /c/Ruby23-x64/lib/ruby/2.3.0/rubygems/ssl_certs/

Now getting:

$ gem install bundler --no-ri --no-rdoc
ERROR:  While executing gem ... (OpenSSL::X509::StoreError)

It was mentioned by another user above.

Is the cause of this issue known?

Cl3MM commented Oct 7, 2016

Thanks @raoel and @binki πŸ‘ !

Here is what I did:

  • download R1 GlobalSign Root Certificate from GlobalSign
  • convert to PEM file: openssl x509 -in Root-R1.crt -inform der -out mycert.pem -GlobalSignRootCA.pem PEM
  • place GlobalSignRootCA.pem in rubygems\ssl_certs
  • profit 🀘

Phew.. finally got this working. What a royal pain in the ass! Here is how I did it (based on @Cl3MM post above):

  1. Download R1 GlobalSign Root Certificate:
  2. Save it somewhere local, so you can easily access it from a command prompt. It should save with the name Root-R1.crt.
  3. Convert to a PEM file. Here is where the post above didn't work for me, but this did: openssl x509 -in Root-R1.crt -out mycert.pem -outform PEM -inform DEF
  4. Copy the new mycert.pem file that it creates into: D:\Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs <-- this path will obviously be different depending on where you've got Ruby installed!

I can now install gems properly without any more annoying SSL errors. This was on Windows 10 Anniversary edition with Ruby 2.3.1

@photonstorm This worked for me thanks!

What worked for me was simply downloading the latest RubyGems as a TGZ from here and follow the install instructions from there. No more SSL issues.

Had the same issue today and did what @alexharv074 did.. only I downloaded from Releases the latest 2.6.7 zip and installed manually...
No more issues...

baweaver commented Oct 7, 2016

None of the above solutions are currently working.


  • Upgrading RubyGems to 2.6.7
  • SSL cert mentioned in guide (404 broken)
  • Downloading and installing GlobalSign cert

So is this a thing for every upgrade of RubyGems?

rwingard commented Oct 7, 2016

@photonstorm Worked for me as well--also on Windows 10 Anniversary and ruby 2.3.1. Thank you very much!

kapoorlakshya commented Oct 7, 2016

In addition to the steps by @Cl3MM and @photonstorm, I also had to add an environment variable in Windows to make it work:

Value: C:\Opt\Ruby\Ruby193\mycert.pem

I found this in

baweaver commented Oct 7, 2016

Mac OSX Fix

For some stupid reason the openssl libs are borked too, so I hard-resetted them all.

brew uninstall --force openssl
brew install openssl

It's either that or a combination of the above steps as well with getting the latest RubyGems ala

mondaini commented Oct 7, 2016

Thankyou @kapoorlakshya, @Cl3MM and @photonstorm. Now I've got it working.

@baweaver’s solution works for me.

It looks like Rubygems updated their certificate.

For RVM users:

rvm get stable
rvm osx-ssl-certs update all
rvm rubygems latest

pdai1y commented Oct 8, 2016

Solution posted by @photonstorm worked perfectly for me on Win 10 :)

robgha01 commented Oct 8, 2016

I tested the solution posted by @photonstorm but it dide not work for me i installed the ruby "Ruby 2.3.1-p112" but i get

ERROR:  Could not find a valid gem 'sass' (>= 0), here is why:
          Unable to download data from - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

i can however reach that file using the browser and url ""...

the solution is with @alexharv074. I did his options he said and RUN :DD!! i have windows 8.1 and now run correctly

DHB commented Oct 8, 2016

Solution posted by @photonstorm worked like a charm. Windows Anniversary edition, MRI 2.3.1p112 [x64-mingw32] ...
Had suddenly problems to gem install arel 7.1.3. @photonstorm: Thank you so much.

If you have the same configuration like me : Windows and Rubygems 2.4 I would recommend to upgrade to Rubygems 2.6 ( the phrase "Specially since RubyGems 2.4 is broken on Windows." found in the tuto made me ). to do so :

1/download the latest version :

2/and install it with :

C:>gem install --local C:\rubygems-update-2.6.7.gem

change the above path if needed

C:>update_rubygems --no-ri --no-rdoc

@jeffmichaud not safe but works(use http instead of https)

ceefour commented Oct 9, 2016

@jcalestani no .gem, just .zip and .tar.gz :(

Update: I got it from

Wow, your step-by-step worked! Thanks!

realvjy commented Oct 9, 2016

404 Not found AddTrustExternalCARoot-2048.pem

realvjy commented Oct 9, 2016

@photonstorm thanks, Your tips work

@jcalestani & @ceefour it worked Thanks

marlofs commented Oct 9, 2016

i tried to install sass and encountered an error ssl something. i got mine worked using the following:

gem sources -a


gem install sasss


borela commented Oct 10, 2016

@photonstorm Thank you.

altbdoor commented Oct 10, 2016

This whole Gist is actually properly documented on rubygems/guides, but it appears that the page is a little outdated as well.

For anyone interested, the SSL cert link is not exactly broken. Its just that RubyGems restructured their folder. The same SSL cert can be found in the link below.

Thank you, thank you, thank you for posting this. I would never have been able to get past this problem without your helpful instructions. (And yes, I read the whole article, and your embedded "thank you for reading" made me smile.)

wclear commented Oct 11, 2016

For Windows 10 64-bit, RubyGems v2.5.1: downloading all the SSL certificates from the subfolders in and saving them into the C:\Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs (at least that's the path after a fresh installation today) folder seemed to work. There was no need to recreate the subfolder structure, just put all files directly into the ssl_certs folder. Existing files with the same name were overwritten.

sarog commented Oct 11, 2016

Guys, there's an even simpler method.

I created a new file called root-r1.pem inside the folder C:\Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs and then copy/pasted the following GlobalSign Root R1 certificate (click "View Base64"). It worked on Windows 10 x64 without having to mess around with OpenSSL DER/PEM conversions.


Firenz commented Oct 11, 2016

@jcalestani thanks!! It worked ^_^

pawitk commented Oct 12, 2016

@sarog thanks for the simplified solution! I got it working in minutes!

@sarog you are a hero, that saved so much time

@sarog, Dude you're a hero! Tried all the other solutions but none worked.
Can you explain why you create a new .pem file with a new name?

@sarog saved the day!


Thanks a ton, @sarog! Worked like a charm.

@sarog OMG thank you very much though I don`t know why it works. :)

mrstebo commented Oct 13, 2016

@photonstorm Your solution worked for me.

@sarog well done! I love your solution it should be bumped up to the top of the page

Fatekiller23 commented Oct 13, 2016

....seems only i get error msg...after follow your steps. updated: hah ,thanks @sarog his solution works.

@sarog @justinconnell

i agree, your solution @sarog worked for me.

@sarog Worked for me as well. Thanks man. πŸ‘

smosab commented Oct 13, 2016

Thank you. This was vey helpful!

@photonstorm Solved! In my case it took about 1 minute for anything to happen after running gem install jekyll bundler, but it worked!

Pizdetss commented Oct 14, 2016

Still doesn't work for me. Even after trying all the above.
Windows 7
ruby 2.1.5p273
gem 2.6.7
copied certificate GlobalSignRootCA.pem from to rubygems\ssl_certs folder
ran: gem install bundler
result: Unable to download data from - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

EDIT: Changing source to http instead of https worked.

terev commented Oct 14, 2016

@wclear thanks! this worked for me too

@sarog thanks!

@sarog thanks! your solution worked quite well for me!

@sarog Thanks for the fix. :)

cyuno commented Oct 15, 2016

Using upgraded windows 10 from windows 7. The pem file link is broken. I uninstalled older versions of Ruby. Installed the latest stable version of Ruby (Ruby23). No problems at all.

Thanks @sarog !!

@sarog you are awesome

Seems like the folder structure was changed, so the link to AddTrustExternalCARoot-2048.pem doesn't work anymore. I tried the same procedure with AddTrustExternalCARoot.pem (couldn't find the -2048 version) but that didn't work. (Maybe one of the other .pem files would - like GlobalSignRootCA.pem).

In the end I went with @sarog's solution, which worked. Kudos both @luislavena and @sarog!

@wclear thanks! Totally worked for me.

It's alive! Thx @sarog for this

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

My version gem 2.5.1

I just followed the steps here
Downloads a new version of the ruby gem locally and allows you to upgrade and that was me. Really quick fix

drnic commented Oct 17, 2016

Thanks @PatrickWalker - guides instructions worked a treat.

nimi09 commented Oct 17, 2016

this is ridiculous . can't get it to work on osx 10.10.5 Yosemite

I am on
ruby 2.2.4p230
gem 2.6.7
OpenSSL 1.0.2h 3 May 2016

when i start a new rails app I get the following error:

Fetching source index from
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for

added the certificate as described at

Thank you for this!!!! Am using win7 on a 2009 hp lappy and had rubygems v2.4 installed - now I have 2.6.7 πŸ˜„

mfDK commented Oct 19, 2016

I did both of these instructions here and I'm still getting the SSL error. Anyone else have the same issue?

New link to certificate, since the one above is broken:

I got file not found when trying to download certificate. I believe this is the text of the certificate that we can use to create it.


It works here, thank you! πŸ‘

Thank you. I shold look here to find the new certificate.

csaden commented Oct 21, 2016

I faced the same error (on Mac OSX 10.10.5 Yosemite).

OpenSSL Errors and Rails – Certificate Verify Failed

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (

I deleted rvm and and re-installed but still faced the same problem. I could not brew link --force openssl and ended up stumbling upon this for the solution.

rvm install 2.2.4 --disable-binary
Install whatever ruby version you need.

nimi09 commented Oct 21, 2016

@csaden thanks, that worked for me!!!

Not work for me :(
Having the gem version of 2.5.1
It works before but not working since last three days!

Dave-Piland commented Oct 22, 2016

Not sure if I'm just not following these correctly but none of the above fixes worked for me. HOWEVER, following the steps here fixed the problem with the SSL certs and I can continue gem installs without issue:

*_I swapped "Rails" with "Ruby"
*_Gem version 2.0.15
**Shout out and HUGE THANKS to Kanishk Kunal for figuring this one out

ninoM commented Oct 22, 2016

Holy shit @Dave-Piland you're my fucking hero. Literally nothing worked till I tried out your solution. I don't think where the cacert.pem file is located matters though. I put mine on C:\RailsInstaller\Ruby2.2.0\lib\ruby\2.2.0\rubygems\ssl_certs and just pointed the system variable there. Thanks so much!!!

h404bi commented Oct 22, 2016

@Dave-Piland πŸ‘ you save my life!

The solution of @marlofs worked for me. Thank you!

Anke commented Oct 22, 2016

Thank you, @sarog, just perfect!

welkie commented Oct 23, 2016

Download link for .pem file 404s.

The original solution didn't work for me (Windows 8 x64) the the one by @sarog did. Thank you @sarog!

beni92 commented Oct 24, 2016

Thank you @sarog πŸ‘

i got error while i give bundle install

bundle install
C:/Ruby23/lib/ruby/2.3.0/rubygems/dependency.rb:319:into_specs': Could not find 'bundler' (>= 0) among 11 total gem(s) (Gem::LoadError)

I fixed this problem:
gem source -a

I can confirm that the solution suggested by @Dave-Piland and @kanishkkunal work well.

Error with Ruby Gems on Windows

If you're not keen to define a System Variable for the SSL_CERT (e.g. if you're using a portable dev stack on Windows), then you can combine Kahnishk's instructions with points 2 and 3 of @luislavena's "Manual solution to SSL issue", above.

I noticed that the AddTrustExternalCARoot-2048.pem in this gist is now a 404; so use the link to Kahnishk's cacert.pem instead:


Hope this helps someone.

Props to @Dave-Piland, @kanishkkunal, and of course @luislavena

This page has a solution to the problem


In Windows 10, I've just downloaded the zip at and executed it. Done!

  • Ruby 2.2.5p319

DWishR commented Oct 25, 2016

How to save the .pem file? I have saved it as "cacert.pem", but the document is still a txt file. Please help

had to save it with firefox. Fsome reason chrome always saved in in text file. Thank u for ever!!!

To solve the problem I:

  1. Downloaded the new cert file from:
  2. Dropped the cacert.pem file in C:\Ruby22-x64\lib\ruby\2.2.0\rubygems\ssl_certs
    That's it.

dthor commented Oct 26, 2016

what to do without admin control? This doesn't work without access to advanced settings?

I've updated my certificates multiple times, but nothing seems to be working. Running on OSX. Any advice?


ghost commented Oct 27, 2016

@deadlydog Thanks so much your solution worked for me (Windows 10-64). I tried many options before this.

wojcikm commented Oct 28, 2016

@alexharv074 Works, thanks a lot. Spend whole night looking on that! // Win 10, Ruby 2.2.5 x64

@deadlydog Thanks man

mrose-mpd commented Oct 29, 2016

Edit: These instructions from a few comments above solved it for me:

To solve the problem I:

  1. Downloaded the new cert file from:
  2. Dropped the cacert.pem file in C:\Ruby22-x64\lib\ruby\2.2.0\rubygems\ssl_certs
    That's it.

dumptyd commented Oct 30, 2016

@mrose-mpd 's solution worked for me.

The ssl certs link seem to not work for me. I tried instead and replaced all certificates under installation dir/ssl_certs with the ones on the repo under said directory / sub-directory. Hope that helps.

Thank you!

Thanks this has been a problem for quite sometime. The solution for me was updating gem to version 2.6.8

hutber commented Oct 31, 2016

The file is no longer available.


ghost commented Oct 31, 2016

yes 404ing at 22:00 GMT

Beautyod commented Nov 1, 2016

Great article - thanks (-:

As others said: It's nice when you update the certificate link.

monkodev commented Nov 2, 2016

Awesome!!! Thanks!!

I succeeded updating SSL certificate in this way.

jcabasc commented Nov 3, 2016

@dgilperez thanks man, what you said did the trick for me, so either that and/or copy the .pem file inside the ssl_certs folder of my ruby version.

rbur004 commented Nov 4, 2016

I finally found which cert.pem file I needed to update. I had updated with update_rubygems, first to 2.6.7, and then to 2.6.8. Neither fixed the issue.

certfile=ruby -ropenssl -e "puts OpenSSL::X509::DEFAULT_CERT_FILE"
echo $certfile

That turned out to be /usr/local/ssl/cert.pem , as I had installed the latest openssl there, and built ruby to point to this version of openssl. You might find it is somewhere else.

On my Mac, I then updated it with
security find-certificate -a -p /Library/Keychains/System.keychain > $certfile
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> $certfile

The root certs had been updated by my browser.

On Linux, I scp'd the cert file to that systems $certfile

cj13579 commented Nov 4, 2016

Unfortunately neither of these solution worked for me but this comment provided the fix that worked for me:

gem source -r
gem source -a
gem update --system
gem source -r
gem source -a

Hope this helps someone else.

bxmas13 commented Nov 4, 2016

Thanks! Your solution worked great for me(Windows 10).


navin09 commented Nov 6, 2016

Nothing worked for me, until I tried @cj13579's solution. Thank you, @cj13579!

@cj13579 One word you are Awesome..!! :)

cyp-v commented Nov 6, 2016

@cj13579 's solution seems to work no matter which version. Great, thank you so much!

Well in my case i still have the problem i try solution from @cj13579 but still have the problem

Thanks @cj13579 it works but on http

  • I had to change the Gemfile to work with http instead of https.
    does wnyone have a solution that works with https?

Worked more than me on deadline. Thanks!

sabrinashie commented Nov 8, 2016

After a long time, I finally managed to get it to work!!!! YAY!
If you're still having problems on an OSX Yosemite environment with rvm installed, here's what I did:

  1. I did what @cj13579 suggested, but it errored on the last step. Thankfully, it gave me a more specific error than before, specifically, my GlobalRootCA cert was expired.
  2. This link showed me how to delete the expired GlobalRootCA cert/retrieve the unexpired cert: Homebrew/legacy-homebrew#32251
  3. Then I realized my path file was incorrect and it was going to /etc/openssl instead of /usr/local/etc/openssl/certs. You can fix this by disabling binaries as explained here:

Hope this helps!

the link to the pem-file has expired.

This solution didn't work for me. But I installed latest rubygems-update from and run


and now it works.

henrythedj commented Nov 8, 2016

This solution hasn't worked for me yet - I tried @MaxSkyfire 's solution and I still got the same error.

Luckily, @cj13579 provided a solid answer up there ^ (from here ) reposted here for posterity:

gem source -r
gem source -a
gem update --system
gem source -r
gem source -a

Nexxado commented Nov 9, 2016

@MaxSkyfire same worked for me.

Steps taken:

  1. Download rubygems_update version 2.6.8 (latest version at this time)
  2. Install rubygems_update: gem install rubygems-update-2.6.8.gem
  3. Run it update_rubygems --no-ri --no-rdoc
  4. Make sure gem -v returns version 2.6.8
  5. [Optional] Uninstall rubygems_update: gem uninstall rubygems-update -x

now everything works fine.

Mazorati commented Nov 9, 2016

Still have this error:

iMac:Downloads Admin$ gem -v
iMac:Downloads Admin$ gem install cocoapods
ERROR:  SSL verification error at depth 2: certificate has expired (10)
ERROR:  Certificate /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA expired at 2014-01-28T12:00:00Z
ERROR:  SSL verification error at depth 2: certificate has expired (10)
ERROR:  Certificate /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA expired at 2014-01-28T12:00:00Z
ERROR:  SSL verification error at depth 2: certificate has expired (10)
ERROR:  Certificate /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA expired at 2014-01-28T12:00:00Z
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
ERROR:  SSL verification error at depth 2: certificate has expired (10)
ERROR:  Certificate /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA expired at 2014-01-28T12:00:00Z

jeesus commented Nov 11, 2016

@MaxSkyfire thanks, man!

thanks @Nexxado steps worked

jdinkla commented Nov 11, 2016

@Nexxado @MaxSkyfire it works on my Window 10 machine. Thanks! I took the same 5 steps as @Nexxado.

thybzi commented Nov 12, 2016

One more simple way with RubyGems 2.5.1 on Windows (worked for me to fix gem install rhc on Windows 10 x64)

Long story:

Short story:

  1. open git bash (Mintty, four-colored icon)
  2. set env vars: export SSL_CERT_DIR=/mingw64/ssl/certs && export SSL_CERT_FILE=/mingw64/ssl/cert.pem
  3. now you can install your favorite gems in this console

thybzi commented Nov 12, 2016

But this solution from @Nexxado must be the best (as it actually updates rubygems version):

Thanks @y-takashina - I tried a few other solutions from this page, but all resulted in the same problem I was trying to fix :) That page worked for me

@thybzi Your short history saved my life good sir, I owe you a beer.

Thank you henrythedj you are lifesaver

@sarog save my life

(as above) Thanks @Nexxado, the steps worked on my Window 10 machine πŸ‘

Rorkal commented Nov 16, 2016

The solution #1 here worked or me :

1. Add insecure source

gem sources -a is recommended for security over

Do you want to add this insecure source? [yn] y added to sources

2. Remove secure source

gem sources -r removed from sources

3. Update source cache

gem sources -u
source cache successfully updated

I want to thank so many people, it was a ride. (ruby 2.3.0 ; rubygems 2.5.1)

Here's what got me through:
Section Title: " Solution #3 and #4. "

It tells you to:

  • 'Save as...' the page on the following link and name it "ca-bundle.crt":
  • Put the "ca-bundle.crt in the ssl_certs map: "C:\row\Ruby23\lib\ruby\2.3.0\rubygems\ssl_certs"
  • Open cmd type: "openssl" press enter, and paste "x509 -in ca-bundle.crt -out MozBundleCA.pem -outform PEM" press enter
  • Install your gem again.

I was struggeling with getting openssl. So here's what helped me out with that:
Title: " How to install Openssl on Windows7 "

Thank you @Gratefull, worked for me on Win10.

@Gratefull, your solution worked for me. Thanks!

joehany commented Nov 21, 2016

Thanks @sarog worked!

Thanks @Nexxado your solution worked flawlessly on Win 10 x64 with Ruby 2.3 and gem 2.5.1 installed!

Thank you, @Gratefull. Worked for me at a glance (for Firefox 50.0 on Windows 7 32-bit).

jullus commented Nov 25, 2016

Thanks @Gratefull your solution worked flawlessly on Win 10 x64 with Ruby 2.3 !!!

Thanks @Gratefull for that final bridge.

thanks @Nexxado. Win 10 x-64 Ruby 2.3.1

AumCoin commented Nov 28, 2016

Ruby is so f*cking stupid, I wish I had just learned Python years ago instead of this crap. My 1.93 install broke and there was no obvious way to fix it, so I figure I'll try one of these RubyInstallers. Of course I get this stupid SSL message. Every time I try to do anything new with Ruby it requires half a day of looking for "workarounds". I find my way to this stupid page and the solution doesn't work, because the .pem file link is broken. I'm so sick of this retarded language. The attraction is... slightly faster than Python? This language was never needed. What a stupid, stupid, thing.

Thanks for the detailed steps.
The Link in 'We need to download AddTrustExternalCARoot-2048.pem.' in Step 1 throwing 404.

If you are tearing your hair out with Windows 10 then this works, just ignore the fact that its rails

ysrb commented Nov 30, 2016

You can use this PEM instead - @crowchirp

djibtgy commented Nov 30, 2016

@crowchirp This is a link for downloading AddTrustExternalCARoot-2048.pem :

I respected all the steps but I still got the same problem :
ERROR: Could not find a valid gem 'fpm' (>= 0), here is why: Unable to download data from - SSL_connect returned=1 errno=0 state=error: certificate verify failed (

gluons commented Dec 1, 2016

cdtinney commented Dec 2, 2016

@Gratefull Thank you. Solution worked for me as well. Win10x64, Ruby v2.3.

itaditya commented Dec 2, 2016

Now the link to download the .pem certificate shows 404 Not Found

Thanks for this solution. This is exactly what I did that worked for me on macOS.

gem install rubygems-update --source ""
gem uninstall rubygems-update -x

thank you for the guide! Solution worked for me as well

kakoma commented Dec 30, 2016

Even with the official guide up-to-date, this was a great resource. Thanks a lot

koryteg commented Jan 9, 2017

thanks for this! you also might want to link to or, update your docs to include this solution: rubygems/rubygems#665 (comment)

I had the same issue and updating rubygems didn't fix it. but updating openssl-osx-ca did.

just a thought.

thedamon commented Jan 23, 2017

Downloads gem install --local rubygems-update-2.6.7.gem
Successfully installed rubygems-update-2.6.7
Parsing documentation for rubygems-update-2.6.7
Installing ri documentation for rubygems-update-2.6.7
Done installing documentation for rubygems-update after 22 seconds
1 gem installed
➜  Downloads update_rubygems --no-ri --no-rdoc
zsh: command not found: update_rubygems

Not sure if i'm missing something obvious... but this not the work for me! command not found?

The solution is very Simple :)
To connect without using SSL, edit your Gemfile sources and change 'https' to

Rihab commented Jan 25, 2017

Works !! Thank you for the workaround. I did not read everything but directly went to the workaround : Installing using update packages

Good One!

  1. -Download zip file from

  1. Extract zip file

  2. Double click on setup and let it do its thing

  3. Open cmd prompt as admin and run gem install sass using command

gem install sass

  1. Check for success

sass -v

Happy Coding !

thanks a lot !!

Thank you!

made my day thanks bud

Jing-Luo commented Aug 8, 2017


After spending a few hours on this, I just have to say -- THANK YOU. All other solutions failed.

Agcaiyun commented Sep 9, 2017

Thumbs up! I think the installer is very fussy about the url used.After a few hours on this problem,I get your pages,but i have to change the url to "", the problem was solved.Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment