missing the openssl lib when rbenv install 2.1.0-dev
$: rbenv install 2.1.0-dev
failed on Mac OSX 10.8.4 with error:
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
my rbenv, ruby-build and openssl is installed via homebrew .
the problem i think is ruby-build plugin can't find appropriate-versioned openssl when compiling ruby, ruby-build used the system openssl lib, which is too old for compiling ruby 2.0
$: openssl version
$: OpenSSL 0.9.8x 10 May 2012
and brewed version openssl is 1.0.1e
$: brew list openssl
/usr/local/Cellar/openssl/1.0.1e/bin/openssl
/usr/local/Cellar/openssl/1.0.1e/bin/c_rehash
/usr/local/Cellar/openssl/1.0.1e/include/openssl/ (75 files)
/usr/local/Cellar/openssl/1.0.1e/lib/libcrypto.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.1e/lib/libssl.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.1e/lib/engines/ (12 files)
/usr/local/Cellar/openssl/1.0.1e/lib/pkgconfig/ (3 files)
/usr/local/Cellar/openssl/1.0.1e/lib/ (4 other files)
/usr/local/Cellar/openssl/1.0.1e/share/man/ (1217 files)
$: brew link openssl
Warning: openssl is keg-only and must be linked with --force
Note that doing so can interfere with building software.
so the solution is
brew link openssl --force
after that, openssl version 1.0.1e will be found first in the path when run openssl
and another solution is
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.1e rbenv install 2.1.0-dev
Written by fang
Related protips
7 Responses

Thanks ! "brew link openssl --force" worked for me

Thanks for the info - spent a long time trying to work around this issue but "brew link openssl --force" also worked for me

how about with macports?

Have this page bookmarked since I've needed it a few times but after upgrading to Mavericks it no longer worked for me - this did:
CONFIGURE_OPTS="--with-openssl-dir=brew --prefix openssl
" rbenv install 2.1.2

The comment system appears to have stripped them, but there should be backticks around
brew --prefix openssl
@jonathancanales, i don't know, i never tried macports.
@rwdrwd, thanks for sharing