无法安装任何 RubyGems,连接到源时出现无效参数错误 [gem 2.4.8]

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

我无法在此 Mac 运行 OSX 10.11.

上安装任何 ruby gem

这是我尝试安装 gem 时发生的情况:

$ gem install rspec

ERROR: Could not find a valid gem 'rspec' (>= 0), here is why:

Unable to download data from https://rubygems.org/ - Errno::EINVAL: Invalid argument - connect(2) for "rubygems.org" port 443 (https://rubygems.org/specs.4.8.gz)`

我认为这可能是 ssl 问题所以我尝试了 运行

$ openssl s_client -showcerts -connect rubygems.org:https

connect: Invalid argument

connect:errno=22

有什么问题吗?感谢您的宝贵时间和帮助

rubygems.org 上的 SSL 存在 [已知] 问题,而不是在您的计算机上。将源明确设置为 HTTP,而不是 HTTPS:

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

在您的 Gemfile(如果有)中,您可能应该设置:

source 'http://rubygems.org'

作为最顶行。