LoginSignup
6
4

More than 3 years have passed since last update.

Ruby | EOL Rubyがインストールできない!

Last updated at Posted at 2019-11-09

EOL => End Of Life
つまり、2.4以下のバージョンのrubyのことです。
Ruby Lifecycle (EOL)

2.3.5をrbenvでインストールをしようとしたら、 以下のエラーログとともに失敗してしまいました。
そこでこの記事ではその原因と解決方法を記載します。

あ、ちなみにMacです。

~ $ rbenv install 2.3.5
ruby-build: using openssl from homebrew
Downloading ruby-2.3.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.bz2
Installing ruby-2.3.5...
ruby-build: using readline from homebrew

BUILD FAILED (OS X 10.15 using ruby-build 20191105)

Inspect or clean up the working tree at /var/folders/6n/8_hv1dkd2bvg1smftl8zybx40000gn/T/ruby-build.20191109131611.38543.IPfI1B
Results logged to /var/folders/6n/8_hv1dkd2bvg1smftl8zybx40000gn/T/ruby-build.20191109131611.38543.log

Last 10 log lines:
installing capi-docs:         /Users/anthony_kiedis/.rbenv/versions/2.3.5/share/doc/ruby
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/anthony_kiedis/.rbenv/versions/2.3.5
  --with-openssl-dir=/usr/local/opt/openssl@1.1
  --with-readline-dir=/usr/local/opt/readline
  CC=clang
  LDFLAGS=-L/Users/anthony_kiedis/.rbenv/versions/2.3.5/lib
  CPPFLAGS=-I/Users/anthony_kiedis/.rbenv/versions/2.3.5/include

原因

最新のruby-build 20191105はopenssl@1.1に依存しているが、2.4以下のrubyがこれには対応していないことが原因

参考

Depends on:

autoconf 2.69 Automatic configure script builder
openssl@1.1 1.1.1d Cryptography and SSL/TLS Toolkit
pkg-config 0.29.2 Manage compile and link flags for libraries
readline 8.0.1 Library for command-line editing

The openssl extension of Ruby version before 2.4 is not compatible with OpenSSL 1.1.x.

解決方法

ここに記載していることと同じです。
Cannot install Ruby versions < 2.4 because of openssl@1.1 dependency #1353

# 対応しているopenssl 1.0.2を入れます
$ brew install openssl

# 手動で使うopensslの場所を指定してrbenv installします
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.3.5

# ちなみに僕はfishユーザなので、fishを使っている人は以下のコマンド
$ env RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl/ rbenv install 2.3.5

以上 :fu: :goberserk: :fu:

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4