Last Updated: September 09, 2019
· dfang

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/include/openssl/ (75 files)
/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


7 Responses
Add your response

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

over 1 year ago ·

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

over 1 year ago ·

how about with macports?

over 1 year ago ·

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

over 1 year ago ·

The comment system appears to have stripped them, but there should be backticks around

brew --prefix openssl

over 1 year ago ·

@jonathancanales, i don't know, i never tried macports.

over 1 year ago ·

@rwdrwd, thanks for sharing

over 1 year ago ·