1

So I am trying to install ruby 2.5.0 with rbenv and this is my issue:

$ 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 20171226-3-g01e7b7b)

Inspect or clean up the working tree at /var/folders/6d/p9mv033d1xv9hc4xbdr7fxf40000gp/T/ruby-build.20180212121818.63339
Results logged to /var/folders/6d/p9mv033d1xv9hc4xbdr7fxf40000gp/T/ruby-build.20180212121818.63339.log

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

The issue seems to be with paths between the mac version of OpenSSL and the Homebrew version. I use Homebrew on my mac for everything FYI.

So here is my openssl folder:

$ which openssl
/usr/local/opt/openssl/bin/openssl
$ openssl version
OpenSSL 1.0.2n  7 Dec 2017

I have this line in my .bash_profile to make it use the newer version installed with Homebrew:

export PATH="/usr/local/opt/openssl/bin:$PATH"

It seems to be loading the correct OpenSSL version now but it still wont compile correctly. It does this with any version of ruby.

Does anyone know what is going on specifically? Any help would be great!

jww
  • 97,681
  • 90
  • 411
  • 885
Luke
  • 13
  • 4
  • Based on *`ruby-build: use readline from homebrew`* followed by *`BUILD FAILED`*, have you installed ReadLine? If I recall correctly, OpenSSL does not use ReadLine but the Homebrew tools may. – jww Feb 12 '18 at 22:36
  • Also see [homebrew openssl force link site:stackoverflow.com](https://www.google.com/search?q=homebrew+openssl+force+link+site%3Astackoverflow.com). Lots of similar questions, like [Homebrew refusing to link OpenSSL](http://stackoverflow.com/q/38670295), [Update OpenSSL on OS X with Homebrew](http://stackoverflow.com/q/15185661), [How to install latest version of openssl Mac OS X El Capitan](http://stackoverflow.com/q/35129977), [How to upgrade OpenSSL in OS X?](http://apple.stackexchange.com/q/126830), [Openssl installation using Homebrew fails](http://superuser.com/q/486389), etc. – jww Feb 13 '18 at 08:39
  • As a suggestion; I would ensure that homebrew has been updated & that you also have the latest version of the Xcode command line tools. I had a few errors doing this but with RVM – ThorTL67 Feb 13 '18 at 09:57

1 Answers1

0

This error happened to me after I upgrade homebrew.

I just spent 2 days trying to fix this error, basically reinstalled everything. This is how I found the solution (TL; TR I'm so dumb)

  1. Ran brew doctor
  2. It said "Your Xcode version is too old, you are using 9.0 and latest is 10.0"
  3. I went to app store, open updates tab and nothing there
  4. Searched for Xcode and noticed that version 10 was available
  5. Opened Xcode after installation
  6. Ran rbenv install 2.5.0 and worked.
  7. Hate my all existence.
rderoldan1
  • 3,517
  • 26
  • 33