2017-02-17 57 views
0

我刚刚更新并重新加载RVM,RVM安装2.4.0,当我运行gem我得到:引入nokogiri的Mac上安装OpenSSL的生成失败使用Ruby 2.4

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

我用Google搜索了一下,发现几个声称解决方案,但没有找到一个工作,除了建议使用不安全的gem网址,我不想这样做。

BTW,安装OpenSSL,而不是由BREW:

➜ ruby-2.4.0  brew install openssl 
Warning: openssl is a keg-only and another version is linked to opt. 
Use `brew install --force` if you want to install this version 

我怎样才能获得宝石与安全宝石源工作?

+0

另请参阅[Brew拒绝链接openssl](http://stackoverflow.com/q/38670295),[在OS X上用Homebrew更新OpenSSL](http://stackoverflow.com/q/15185661),[如何安装最新版本的OpenSSL Mac OS X El Capitan](http://stackoverflow.com/q/35129977),[如何在OS X中升级OpenSSL?](http://apple.stackexchange.com/q/ 126830),[使用HomeBrew的Openssl安装失败](http://superuser.com/q/486389)等 – jww

回答

1

的解决方案是安装酿造的OpenSSL:已

brew install --force openssl

(我有一个奇怪的消息说,`--force被忽略,但它没有安装好。)

然后执行一个brew info openssl和RTFM! :)基于它告诉我,我已将此添加到我的〜/ .zshrc文件:

# For Ruby 2.4 to find brew's OpenSSL: export LDFLAGS=-L/usr/local/opt/openssl/lib export CPPFLAGS=-I/usr/local/opt/openssl/include export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

于是,我打开一个新的终端窗口并重新安装红宝石2.4:

rvm reinstall 2.4

之后,gem工作。