[RVM] Could not load OpenSSL エラーの解決方法

RVM で install した Ruby 環境で bundle install すると Could not load OpenSSL エラーが発生したので、この解決方法をご紹介します。

RVM

前提条件

  • macOS : version 10.14.5
  • rvm : version 1.29.8-next
  • openssl : default path
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.5
BuildVersion:	18F132
$ rvm version
rvm 1.29.8-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ which openssl
/usr/bin/openssl

Could not load OpenSSL エラーの解決方法

Could not load OpenSSL エラーメッセージ

$ 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.

rvm pkg install openssl で Open SSL を別途インストールして、rvm install する Ruby にこの Open SSL を使うようにすれば解決します。

rvm pkg install openssl
rvm remove 2.4
rvm install 2.4 --with-openssl-dir=$HOME/.rvm/usr

以上、RVM で Could not load OpenSSL エラーを解決した、現場からお送りしました。

参考情報