ruby-build: Failing to install 2.5.0 on OSX

Hello there,

I have been trying to run rbenv install 2.5.0 all morning. This is the message I get:

rbenv install 2.5.0
ruby-build: use openssl from homebrew
Downloading ruby-2.5.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.bz2
Installing ruby-2.5.0...
ruby-build: use readline from homebrew

BUILD FAILED (OS X 10.13.3 using ruby-build 20180224)

Inspect or clean up the working tree at /var/folders/bh/tkwkgbpj7fb9fy52hxwydxr80000gn/T/ruby-build.20180228135045.1996
Results logged to /var/folders/bh/tkwkgbpj7fb9fy52hxwydxr80000gn/T/ruby-build.20180228135045.1996.log

Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/usr/local/opt/rbenv/versions/2.5.0
  --with-openssl-dir=/usr/local/opt/openssl
  --with-readline-dir=/usr/local/opt/readline
  CC=clang
  CFLAGS= -O3 -Wno-error=shorten-64-to-32
  LDFLAGS=-L/usr/local/opt/rbenv/versions/2.5.0/lib
  CPPFLAGS=-I/usr/local/opt/rbenv/versions/2.5.0/include

I have tried

CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.5.0

and

CONFIGURE_OPTS="--with-openssl-dir=/opt/local" rbenv install 2.5.0

I was originally on OS X Sierra but upgraded to High Sierra (hoping it would fix this problem). I have run brew doctor, brew update, and brew upgrade. I have also tried installing and re-installing rbenv. Attached is the log using brew --prefix openssl.

I was able to use 2.4.0 just fine. which openssl returns /usr/local/opt/openssl/bin/openssl.

Thank you for your time . ruby-build.log

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

OS X 10.14.3 XCode 10.1 Tried to install ruby 2.4.2 with rbenv. The same issue was with 2.5.0. It is OS issue neither ruby version.

The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/myUserName/.rbenv/versions/2.4.2
  --with-openssl-dir=/usr/local/opt/openssl
  --with-readline-dir=/usr/local/opt/readline
  CC=clang
  LDFLAGS=-L/Users/myUserName/.rbenv/versions/2.4.2/lib -L/usr/local/opt/openssl@1.1/lib
  CPPFLAGS=-I/Users/myUserName/.rbenv/versions/2.4.2/include -I/usr/local/opt/openssl@1.1/include
....
generating makefile exts.mk
*** Following extensions failed to configure:
../.././ext/openssl/extconf.rb:0: Failed to configure openssl. It will not be installed.
*** Fix the problems, then remove these directories and try again if you want.

rbenv install 2.4.2 got it fixed by running following commands :

     brew reinstall rbenv
     brew reinstall openssl 
     brew reinstall readline

#Added to ~/.zshrc (my shell) export LDFLAGS=“-L/usr/local/opt/openssl/lib” export CPPFLAGS=“-I/usr/local/opt/openssl/include” export PKG_CONFIG_PATH=“/usr/local/opt/readline/lib/pkgconfig” export PATH=“/usr/local/opt/openssl/bin:$PATH” export LDFLAGS=“-L/usr/local/opt/readline/lib” export CPPFLAGS=“-I/usr/local/opt/readline/include” export PKG_CONFIG_PATH=“/usr/local/opt/readline/lib/pkgconfig”

I was not able to get rbenv to work. However, this worked:

λ →  rvm install 2.5.0 --with-openssl-dir=/usr/local/opt/openssl/bin/openssl

However, the following did not:

CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl/bin/openssl" rbenv install 2.5.0

Anyone have any idea why? I much prefer to use rbenv 😦