【问题标题】:"Unable to require openssl" when trying to install ruby gems on OS X尝试在 OS X 上安装 ruby​​ gem 时“无法要求 openssl”
【发布时间】:2015-08-29 19:19:07
【问题描述】:

自从我升级到 OS X 10.10 Yosemite 后,尝试安装 ruby​​ gem 时出现以下错误:

ERROR:  While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

但是当我执行which openssl 时,它会显示路径:

/usr/local/bin/openssl

我已经卸载并重新安装了 rvm 和 ruby​​,但仍然遇到同样的错误。

如何安装 Ruby gem?

【问题讨论】:

标签: ruby macos openssl rubygems bundler


【解决方案1】:

看起来 gem 安装程序找不到您的 openssl。

用你的 ruby​​ 版本试试这个:

brew install openssl
rvm reinstall 2.3.4 --with-openssl-dir=`brew --prefix openssl`

【讨论】:

    【解决方案2】:

    Ruby on Yosemite 的 OpenSSL 问题可能是由于您安装的 Ruby 版本试图在 /etc/openssl/certs 中找到 OpenSSL 证书,而不是在 /usr/local/etc/openssl/certs 的新位置。尝试reinstalling ruby using the --disable-binary switch,以便在本地计算机上重新构建源代码,而不是使用预编译的二进制文件。例如:

    rvm uninstall 2.2.0
    rvm install 2.2.0 --disable-binary
    

    【讨论】:

    • 这是我的解决方案@jdeleon
    • 看起来 RVM 现在会检查这个 - 它输出“'/usr/local/etc/openssl/cert.pem' 中的证书已经是最新的......”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-14
    • 2017-12-17
    • 1970-01-01
    • 2015-11-05
    • 1970-01-01
    相关资源
    最近更新 更多