The Ruby openssl extension was not compiled. Missing the OpenSSL lib?エラーの解決法をメモ

rbenvでrubyをインストールした時にでたエラーの解決法
rbenvはrubyのバージョンを切り替える事ができるコマンド。
※macの場合はhomebrewでrbenvをインストール

エラー発生

指定バージョンのrubyをインストール

rbenv install 2.0.0-p353

エラー発生

Downloading ruby-2.0.0-p353.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/78282433fb697dd3613613ff55d734c1
Installing ruby-2.0.0-p353...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/1t/x1p587mn79x7k3dc855825sm0000gn/T/ruby-build.20150120012737.63793
Results logged to /var/folders/1t/x1p587mn79x7k3dc855825sm0000gn/T/ruby-build.20150120012737.63793.log

Last 10 log lines:
installing default gems:      /Users/[username]/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
                              bigdecimal 1.2.0
                              io-console 0.4.2
                              json 1.7.7
                              minitest 4.3.2
                              psych 2.0.0
                              rake 0.9.6
                              rdoc 4.0.0
                              test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

エラー内容の通り、opensslがないと言っているので確認する

brew list | grep openssl

既に入っていた・・・

解決法

homebrewのアップデート

brew update

※念のため

readlineインストール ※入ってなかった場合のみ

brew install readline

readlineとopensslのアップグレード

brew upgrade openssl readline

ruby-buildインストール

brew uninstall ruby-build
brew install --HEAD ruby-build

※最初にアンインストールしておく

rubyインストール

RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p353

これでインストールされればOK。
まだインストールできない場合、色々と環境により、パス指定やXCodeのアップグレードなど必要になる場合があるかも。

その他おすすめの備忘録

Tagged with:
 

コメントを残す