SSL Error During Gem Installation (on MinGW64-MSys

2019-06-06 09:24发布

问题:

I'm using a MinGW64-MSys2 environment. When I try to install a package with gem install <package name> I get something like this SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)

回答1:

Depends on what shell you use msys or mingw* and what ruby you use you need install ca-certificates package:

pacman -S mingw-w64-i686-ca-certificates

or

pacman -S mingw-w64-x86_64-ca-certificates

or

pacman -S ca-certificates


回答2:

Try downloading the http://curl.haxx.se/ca/cacert.pem certificate. Then, point a special environment variable to it like that: export SSL_CERT_FILE=~/cacert.pem After that, issue an update command: gem update --system The problem should be solved after that. Relaunch the console and continue your work.