Skip to content

Instantly share code, notes, and snippets.

@urouro
Created February 9, 2016 10:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save urouro/532f24ad6a52a96a921e to your computer and use it in GitHub Desktop.
Save urouro/532f24ad6a52a96a921e to your computer and use it in GitHub Desktop.
rbenv install 2.2.4, but failed with`The Ruby readline extension was not compiled.` / Mac OS X El Capitan, rbenv 1.0.0, ruby-build 20160111
% ruby-build --version
ruby-build 20160111
% rbenv --version
rbenv 1.0.0

Failed

% rbenv install 2.2.4
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
Installing ruby-2.2.4...

BUILD FAILED (OS X 10.11.3 using ruby-build 20160111)

Inspect or clean up the working tree at /var/folders/z7/t9d8k5cx4gnf5mz4zmy1ytj40000gn/T/ruby-build.20160209184944.17951
Results logged to /var/folders/z7/t9d8k5cx4gnf5mz4zmy1ytj40000gn/T/ruby-build.20160209184944.17951.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/kn/.rbenv/versions/2.2.4
  --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/Users/kn/.rbenv/versions/2.2.4/lib 
  CPPFLAGS=-I/Users/kn/.rbenv/versions/2.2.4/include 

Succeeded

~ % brew link readline --force
Linking /usr/local/Cellar/readline/6.3.8... 18 symlinks created
~ % export CFLAGS=-Wno-error=shorten-64-to-32
~ %  CONFIGURE_OPTS="--with-readline-dir=/usr/local --with-openssl-dir=`brew --prefix openssl`" RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.2.4
Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2
Installing ruby-2.2.4...
Installed ruby-2.2.4 to /Users/kn/.rbenv/versions/2.2.4
~ % brew unlink readline
Unlinking /usr/local/Cellar/readline/6.3.8... 18 symlinks removed
~ % rbenv versions
  system
  2.1.0
* 2.1.4 (set by /Users/kn/.rbenv/version)
  2.2.4
@AJCastroChandri
Copy link

Try running
apt-get install -y libreadline-dev

Then try and run
rbenv install 2.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment