Ruby Gem Cucumber Ssl Error and Gem Sources

Ruby gem cucumber SSL error and Gem sources

I had the same issue a while back after moving to ruby 2.0.0

Follow the following steps to solve it

1)Visit the url http://curl.haxx.se/ca/cacert.pem save the contents as a .pem file(Do not save it as a text file.Make sure the extension is .pem)

2)Copy the file to any path in your local eg: C:\ruby200\ca_cert.pem (in my case)

3)Now add an Environment variable with Variable SSL_CERT_FILE and value "C:\ruby200\ca_cert.pem"(without quotes)(path is in my case.Replace with appropriate path) (Environment variables can be added by navigating to Computer -> Advanced Settings -> Environment Variables)

4)Close all your command prompts and restart them.Things should work fine now

gem sources -a not working also SSL error is therre

gem 2.5.1 got installed due to MSI installer of ruby 2.3.1p112 on windows 10 x64 so we need to exclusively update gem version by gem install rubygems-update thereafter update_rubygems. This is available here

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:

  1. Update certificates:

    rvm osx-ssl-certs update all
  2. 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.

Can't install any RubyGems, invalid argument error when connecting to sources [gem 2.4.8]

There are [known] issues with SSL on rubygems.org, not on your machine. Explicitly set the source to be HTTP, not HTTPS:

gem install rspec --source http://rubygems.org

In your Gemfile (if any) you probably should set:

source 'http://rubygems.org'

as the very top line.



Related Topics



Leave a reply



Submit