n9bnug
Last Updated: April 07, 2017
·
6.77K
· 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/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

link: https://github.com/sstephenson/ruby-build/issues/377

7 Responses
Add your response

12366

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

over 1 year ago ·
13712

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 ·
14793

how about with macports?

over 1 year ago ·
16007

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 ·
16008

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

brew --prefix openssl

over 1 year ago ·
16049

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

over 1 year ago ·
16050

@rwdrwd, thanks for sharing

over 1 year ago ·