通过 RVM 安装 Ruby 2.3.8 后,运行 bundle
命令时出现以下错误:
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile
我该如何重新编译带有 OpenSSL 支持的 Ruby?
通过 RVM 安装 Ruby 2.3.8 后,运行 bundle
命令时出现以下错误:
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile
我该如何重新编译带有 OpenSSL 支持的 Ruby?
我的解决方案:
只需执行以下步骤:
1:安装 Homebrew:https://brew.sh/
2:运行以下命令:
rvm install 2.3 --with-openssl-lib=/usr/local/opt/openssl/lib --with-openssl-include=/usr/local/opt/openssl/include
(如果已经安装了 rvm,请使用 reinstall 命令代替 install 命令。)
在我的情况下,安装程序失败是因为它在新版本的openssl中使用了过时的部件。这对我有用:
Go to the "homebrew-core" folder and get back the old openssl gem(1.0.2t)
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git show 8b9d6d688f483a0f33fcfc93d433de501b9c3513:Formula/openssl.rb >> Formula/openssl\@1.0.2t.rb
Enter the file and rename the class "Openssl" to "OpensslAT102t"
brew edit Formula/openssl\@1.0.2t.rb
Install it with brew
brew install openssl@1.0.2t
Once installed, force rvm to use the installed version of ssl
# Install 2.3.8
rvm install 2.3.8 --disable-binary --with-openssl-dir=`brew --prefix openssl@1.0.2t`
# Or reinstall
rvm reinstall 2.3.8 --disable-binary --with-openssl-dir=`brew --prefix openssl@1.0.2t`