OSX Yosemite 和 RVM 破坏了 SSL

OSX Yosemite and RVM broken SSL

我的 OS 是 OS X Yosemite (10.10.5),我已经安装了 RVM 来管理 ruby 版本和 gemsets。我正在使用不同的 gemsets 并且随机遇到 SSL 问题(最常见的是当我重新启动并更改 gemset 时)。因此,例如,这是我在 bundle:

时遇到的错误

Fetching source index from https://rubygems.org/

Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'. Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'. Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://railsapps.github.io/openssl-certificate-verify-failed.html. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

我多次尝试 RVM 站点 (fixing-broken-certificates) 的建议,但都没有成功,似乎唯一的临时修复方法是这个命令: curl https://curl.haxx.se/ca/cacert.pem -o "$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')"(下载并放置特定证书)。

但是过了一段时间(重启和ruby/gemset改变),它又失败了。任何想法?还有其他人有类似的问题吗?

如果您仍然遇到此问题,请尝试以下解决方案:

rvm install 2.3.0 --disable-binary

我也成功地将 SSL_CERT_FILE 环境变量指向 cacert.pem 的本地版本。如果使用上述解决方案重新安装 Rubies 不起作用,您可以尝试一下。