由于使用rbenv的无效ssl导致Gem安装错误

时间:2014-10-06 04:20:30

标签: ruby ssl gem rubygems homebrew

我正在尝试安装新的gem(gem install lunchy),但由于ssl证书而出现以下错误:

ERROR: Loading command: install (LoadError) dlopen(/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method Referenced from: /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib in /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle - /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.3.0/openssl.bundle ERROR: While executing gem ... (NoMethodError) undefined method 'invoke_with_build_args' for nil:NilClass

我尝试了很多修复:

根据此答案bundle install fails with SSL certificate verification error尝试gem update --system,但在该命令上遇到同样的错误。

根据此问题尝试brew install openssl后跟brew link openssl --force,但无济于事:OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv

即使尝试重新安装rbenv和ruby但是也无法正常工作,仍然会遇到同样的错误。

1 个答案:

答案 0 :(得分:2)

在此错误中执行的Ruby不是由rbenv安装的,而是由Homebrew安装的。

如果您尝试使用rbenv,可以运行brew uninstall ruby和/或检查echo $PATH的输出,以确保~/.rbenv/shims在开始时