[Solved] The Ruby zlib extension was not compiled

If rbenv cannot install a particular version

% 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 

Install with options

% RUBY_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib)" rbenv install 2.7.1

If not

% RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.7.1

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *