Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv

I'm trying to install Ruby 2.0.0-p195 using rbenv on a Mac (Mountain Lion) and got this error.

BUILD FAILED

Inspect or clean up the working tree at /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669
Results logged to /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669.log

Last 10 log lines:
installing default gems:      /Users/me/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
                              bigdecimal 1.2.0
                              io-console 0.4.2
                              json 1.7.7
                              minitest 4.3.2
                              psych 2.0.0
                              rake 0.9.6
                              rdoc 4.0.0
                              test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

When I ran brew install openssl it said

Warning: openssl-1.0.1e already installed

Following a solution on this thread https://github.com/sstephenson/ruby-build/issues/305 I tried to install latest stable this way and got the same error

env CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p195

Any ideas?

like image 224
BrainLikeADullPencil Avatar asked Jun 19 '13 00:06

BrainLikeADullPencil


1 Answers

Try adding OpenSSL to the config options using the --with-openssl-dir option:

$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195

If you're using Homebrew, you'll need to install OpenSSL before running the above by running:

$ brew install openssl

UPDATE (see @JarkkoLaine 's comment below):

Just for the record, you should not need to use the config opts anymore with ruby-build and homebrew. However, I had to reinstall openssl with homebrew to make it work: brew uninstall openssl; brew upgrade; brew install openssl; rbenv install 2.0.0-p247. See this for more info.

like image 95
Amir Avatar answered Oct 13 '22 11:10

Amir