首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在使用Ruby 2.4构建openssl时,在Mac上安装Nokogiri失败

在使用Ruby 2.4构建openssl时,在Mac上安装Nokogiri失败
EN

Stack Overflow用户
提问于 2017-02-17 23:34:19
回答 1查看 374关注 0票数 0

我刚刚更新并重新加载了rvm,rvm安装了2.4.0,当我运行gem时,我得到:

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

我在谷歌上搜索了一下,找到了几个所谓的解决方案,但除了建议使用不安全的gem URL之外,没有一个可行的方案,这是我不想做的。

顺便说一句,openssl是安装的,但不是由brew安装的:

代码语言:javascript
复制
➜  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

我怎样才能让gem与一个安全的gem源一起工作?

EN

回答 1

Stack Overflow用户

发布于 2017-02-17 23:34:19

解决方案是安装brew的OpenSSL:

brew install --force openssl

(我收到一条奇怪的消息,说`--force被忽略了,但它确实安装正常。)

然后,执行brew info openssl和RTFM!:)根据它告诉我的内容,我将这个添加到我的~/.zshc文件中:

# 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

然后,我打开了一个新的终端窗口并重新安装了Ruby 2.4:

rvm reinstall 2.4

在那之后,gem开始工作了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42301756

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档