Ruby“无法加载 OpenSSL”错误 macOS Sierra

che*_*emo 7 ruby terminal installation ruby-on-rails

我今天刚下载了 Ruby、Git、Rails 和 Homebrew。我通过 rvm v. 1.29.0 安装了 ruby​​ 我的 Ruby 是 2.4.0 版,Rails 是 5.0.1。我的 macOS 是 10.12 Sierra。

当我尝试通过这样做来制作测试应用程序时, rails new test_app 给了我一个错误:

`Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
RVM are available at rvm.io/packages/openssl.`        
    run  bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
Run Code Online (Sandbox Code Playgroud)

所以我尝试了一个 bundle install 命令,其中同样的错误

Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
RVM are available at rvm.io/packages/openssl.
Run Code Online (Sandbox Code Playgroud)

出现了。

你能帮我弄清楚这一点吗?我一直在谷歌和这里到处寻找可能的帮助,但似乎没有任何效果。我已经尝试了该rvm pkg install openssl命令并重新安装了 Ruby,但无济于事。谢谢!

小智 7

如果您使用 RVM,则可以使用:

rvm install "<ruby-version>" --with-openssl-dir=`brew --prefix openssl`
Run Code Online (Sandbox Code Playgroud)

安装您的 rubyOpenSSL​​ 版本 这应该允许您的捆绑包通过https.