LoginSignup
4
4

More than 3 years have passed since last update.

【macOS Catalina】rbenvで古いバージョンのrubyがインストール出来ない問題を解決

Posted at

問題

rbenvで2.2.2のrubyをインストール出来ない。

実行環境

OS: macOS Catalina
Version: 10.15.4
brew version: Homebrew 2.2.13
rbenv: stable 1.1.2

エラーログ

$ rbenv install 2.2.2

...

The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/user_name/.rbenv/versions/2.2.2
  --with-openssl-dir=/usr/local/opt/openssl@1.1
  --with-readline-dir=/usr/local/opt/readline
  CC=clang
  LDFLAGS=-L/Users/user_name/.rbenv/versions/2.2.2/lib
  CPPFLAGS=-I/Users/user_name/.rbenv/versions/2.2.2/include

解決方法

$ brew install rbenv/tap/openssl@1.0
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" rbenv install 2.2.2

解説

本問題はrbenvがruby-buildを用いてrubyをインストールしており、以下のリンクの Ruby < 2.4 is not compatible with OpenSSL 1.1. の内容の通り、openssl@1.0 をrbenv用にインストールして指定してあげないといけない。

4
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
4
4