Ruby-build: The Ruby readline extension was not compiled.

Created on 16 Apr 2017  路  6Comments  路  Source: rbenv/ruby-build

I'm new with the whole ruby and rbenv...
I was trying to install doing rbenv install 2.4.1
But get the following.
Did RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 2.4.1 and a few other things suggested in other post but to no avail... Please help.

ruby-build: use openssl from homebrew
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.12.4 using ruby-build 20170322)

Inspect or clean up the working tree at /var/folders/xq/zvy8gy656y155stcbh4gpzxr0000gp/T/ruby-build.20170416153259.57281
Results logged to /var/folders/xq/zvy8gy656y155stcbh4gpzxr0000gp/T/ruby-build.20170416153259.57281.log

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

Most helpful comment

needed to do brew link readline --force

All 6 comments

You may need to link readline... That appeared to be my issue.

Try brew install readline. When I ran that, it told me that readline was installed, but wasn't linked.

Did you install readline before building? It works for me on 10.13 (and previous versions) using the RUBY_CONFIGURE_OPTS snippet in the above post, though mine is in my shell profile rc file. I haven't needed to force-link readline for this to work.

needed to do brew link readline --force

It should not be necessary to brew link readline --force. ruby-build will automatically link against Homebrew-installed readline even if readline itself wasn't globally "linked". Doing brew link readline --force can hurt installations of other software and that is _exactly_ why Homebrew doesn't do it by default and discourages doing it entirely.

Is it feasible to require brew readline as a hard dependency on OSX? I feel like it would save a bunch of developer time from people running into this issue and having to look it up and figure out why it isn't working.

We automatically use readline from Homebrew whenever available. https://github.com/rbenv/ruby-build/blob/f6e8dc1ebd17c51a1b9e2d303297caf90e6b21b2/bin/ruby-build#L1010-L1015

Was this page helpful?
0 / 5 - 0 ratings