“Unable to require openssl” when trying to install ruby gems on OS X

痞子三分冷 提交于 2020-04-30 04:55:44

问题


Since I upgraded to OS X 10.10 Yosemite, I get the following error when trying to install a ruby gem:

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

But when I do which openssl it shows me the path:

/usr/local/bin/openssl

I have uninstalled and reinstalled rvm and ruby but still get the same error.

How do I install Ruby gems?


回答1:


OpenSSL issues with Ruby on Yosemite could be a result of your installed version of Ruby trying to locate OpenSSL certificates in /etc/openssl/certs instead of its new location at /usr/local/etc/openssl/certs. Try reinstalling ruby using the --disable-binary switch so that the source is re-built on your local machine instead of using the pre-compiled binary. For example:

rvm uninstall 2.2.0
rvm install 2.2.0 --disable-binary



回答2:


Looks like the gem installer can't find your openssl.

Try this with your ruby version:

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


来源:https://stackoverflow.com/questions/30825792/unable-to-require-openssl-when-trying-to-install-ruby-gems-on-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!