rbenv で特定のバージョンがインストールできない場合
% rbenv uninstall 2.7.1
BUILD FAILED (macOS 11.2.3 using ruby-build 20200520-14-g1642176)
略
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/XXXX/.rbenv/versions/2.7.1
--with-openssl-dir=/Users/cano/.rbenv/versions/2.7.1/openssl
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/cano/.rbenv/versions/2.7.1/lib
CPPFLAGS=-I/Users/cano/.rbenv/versions/2.7.1/include
オプションをつけてインストール
% RUBY_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib)" rbenv install 2.7.1
ダメな場合は
% RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.7.1