certificate verify failed error when installing Ruby gems on Windows
I had this problem too. But using the older version is not the proper solution.
Here is the two solution help to fix this certificate error
1. Using the http instead of https will allow you to install the gem without that error
gem install bundler -r --source http://rubygems.org/
2. Update the certificate based on the solution provided in the below link
https://gist.github.com/luislavena/f064211759ee0f806c88
SSL Error When installing rubygems, unable to install rails gem in windows 10
now I got solution for this issue, using this link http://guides.rubygems.org/ssl-certificate-update/#manual-solution-to-ssl-issue
we need to add GlobalSignRootCA.pem this certificate in ssl_certs folder insted of AddTrustExternalCARoot-2048.pem
go through that above link.
After installing Ruby 2.3.1, I cannot install any Gems on Win10: SSL error
I was able to get it working by setting my source to http instead of https when connecting to rubygems.org. In a command prompt:
> gem sources -r https://rubygems.org -a http://rubygems.org
I tried manually setting a secure certificate (from How to use SSL_CERT_FILE for OpenSSL Windows (OpenSSL 1.0.1c)) but that didn't work for me.
Could not find a valid gem 'rhc'. SSL_connect server certificate verify failed on Windows, Unable to connect OpenShift Server
The problem is that your Windows machine does not recognize the rubygems server certificate as a trusted certificate because Windows don't have its authority certificate present in its trusted certs store.
As a quick fix you'd need to remove the HTTPS version of the rubygems source URL (not HTTP as you did):
gem sources -r https://rubygems.org
This quick fix should make rubygems use the HTTP version which has no certificate checks involved.
But this should not be the definitive fix. Instead you should add the HTTPS source back (using the -a
option) and install a proper CA certificate for the rubygems server cert into your windows trusted CA certs store.
There are quite a few pages that deal with this procedure on the net (google this), e.g. the post here has steps to download and install all CA certificates from the curl
command, to your Windows machine, that fixes the problem permanently and without lowering security.
Could not find valid gem: certificate verify failed
Despite @the Tin Man's helpful answer, my problem was that I didn't have certificates set up in a place that OpenSSL could find them.
Following suggestions(s) in SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/:
An inferior workaround
One can work around this by changing the first line of Gemfile from
source 'https://rubygems.org'
to the non-https form:
source 'http://rubygems.org'
and then do the usual bundle install
. Afterwards, you should restore the first line of your Gemfile to use the https form. This is generally considered a security risk.
What's more, you haven't really addressed the real problem that you lack valid certificates and you will run into trouble if your application calls uses OpenSSL (e.g. net-ssh).
A better fix
See SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/. For OS X users, we ask Ruby to tell us where it's looking for the certificates file, and then use security find-certificate
to populate the certificates file:
$ cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
$ echo $cert_file
$ security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
$ security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"
After I did this, I was able to call bundle install
without an error.
SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/
For RVM & OSX users
Make sure you use latest rvm:
rvm get stable
Then you can do two things:
Update certificates:
rvm osx-ssl-certs update all
Update rubygems:
rvm rubygems latest
For non RVM users
Find path for certificate:
cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
Generate certificate:
security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"
The whole code: https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/osx-ssl-certs
For non OSX users
Make sure to update package ca-certificates
. (on old systems it might not be available - do not use an old system which does not receive security updates any more)
Windows note
The Ruby Installer builds for windows are prepared by Luis Lavena and the path to certificates will be showing something like C:/Users/Luis/...
check https://github.com/oneclick/rubyinstaller/issues/249 for more details and this answer https://stackoverflow.com/a/27298259/497756 for fix.
Related Topics
Run a Cli Thor App Without Arguments or Task Name
Is the Unix Philosophy Falling Out of Favor in the Ruby Community
After Installing a Gem Within a Script, How to Load the Gem
How to Do Case-Insensitive Order in Rails with Postgresql
In Ruby What Is the Meaning of Colon After Identifier in a Hash
What Are the Limitations of Opal
Is There a Ruby One-Line "Return If X"
When and Where Do I Require Files in a Rails Application
Passenger: Cannot Load Such File Rubygems/Builder
Rails Way to Detect Mobile Device
Ruby on Rails - Paperclip and Dynamic Parameters
Ruby: How to Find Out If a Character Is a Letter or a Digit
Examples of 'Things' That Are Not Objects in Ruby
Wicked-Pdf Not Showing Images, 'Wicked_Pdf_Image_Tag' Undefined