stack twitter rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Fixing a "certificate verify failed" error in Ruby

    Updating installed gems
    ERROR: While executing gem ...
    (Gem::RemoteFetcher::FetchError) SSL_connect returned=1
    errno=0 state=SSLv3 read server certificate B: certificate
    verify failed (https://api.rubygems.org/specs.4.8.gz)
    

    Or:

    ERROR: Could not find a valid gem 'activesupport' (>= 0),
    here is why: Unable to download data from
    https://rubygems.org/ - SSL_connect returned=1 errno=0
    state=SSLv3 read server certificate B: certificate
    verify failed (https://api.rubygems.org/specs.4.8.gz)
    

    To fix this (in Windows):

    1. Save the cacert.pem file to a folder, e.g. C:\Tools

    2. Go into your System Environment Variables, and create a new environment variable:

      • Name: SSL_CERT_FILE
      • Value: C:\Tools\cacert.pem
    3. Restart your terminal/console

    If it still doesn't work, are you trying to access a Google API? In that case, use the cacerts.pem from the Google API Client library instead. Note it's called cacerts.pem, so you either save/rename it as cacert.pem or update SSL_CERT_FILE.

    To fix this (in OS X):

    See this StackOverflow answer.