Ruby の「OpenSSL をロードできませんでした」エラー macOS Sierra
概要
今日、Ruby、Git、Rails、Homebrew をダウンロードしました。 RVM v. 1.29.0 経由で Ruby をインストールしました 私のRubyのバージョンは2.4.0です。 Railsは5.0.1です。 私のmacOSは10.12 Sierraです。
ということでテストアプリを作ろうとしたところ Rails 新しい 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`
そこで、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.
現れた。
これを理解するのを手伝ってくれませんか? Google やここで助けを求めてあらゆる場所を探しましたが、何もうまくいかないようです。 rvm pkg install openssl コマンドを試し、Ruby を再インストールしましたが、役に立ちませんでした。ありがとう!
解決策
RVM を使用している場合は、以下を使用できます。
rvm install "<ruby-version>" --with-openssl-dir=`brew --prefix openssl`
OpenSSL を使用して Ruby のバージョンをインストールします。これにより、バンドルが https 経由で Gemserver に接続できるようになります。