Last Updated: October 26, 2022
·
4.742K
· defeated

Build Ruby 2.0.0-p0 on OS X using rbenv

Great news, everyone! So ruby 2.0.0-p0 was released today, just shy of ruby's 20th anniversary!

Naturally I ran into 2(.0.0) problems:

  1. Unfortunately, the version of openssl shipped with OS X (even on Mountain Lion) is out-of-date.

  2. I use rbenv but it hasn't been updated with a definition for 2.0.0-p0 yet.

I could download ruby manually and do the configure / make / make install dance...

Create a ruby-build definition file

.. or we can use rbenv with a custom definition file! Create that by running:

$ echo 'install_package "ruby-2.0.0-p0" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz"' > ./custom-2.0.0-p0

Update OpenSSL

To fix openssl, use Homebrew to install a current version:

$ brew update && brew install openssl

Put it all together

Use ruby-build's support for the CONFIGURE_OPTS environment variable to use the updated openssl library when compiling, and point rbenv at our custom definition file:

$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install ./custom-2.0.0-p0

3 Responses
Add your response

Mmm: configure:

WARNING: unrecognized options: --with-openssl-dir

over 1 year ago ·

it works, but apparently rbenv passes CONGFIGURE_OPTS to dependent libraries as well.

per https://github.com/sstephenson/ruby-build we can use RUBY_CONFIGURE_OPTS instead which are just for building MRI.

nice catch!

over 1 year ago ·

use --with-opt-dir instead.

over 1 year ago ·