Building Ruby 2.1.2 with OpenSSL 1.0.1h

I was having trouble compiling Ruby on my mac, a 2007 macbook that I’ve refused to update as it works (mostly) fine. If you compile it yourself there’s a good chance it’ll fail on something to do with OpenSSL, if the number of questions about it on the internet are any indication. The key to getting it to work was using the right switches when compiling OpenSSL. I nicked the switches from a Homebrew recipehttps://github.com/Homebrew/homebrew/blob/mas…. I also had to edit the Makefile (with some help from this emailhttp://marc.info/?l=openssl-users&m=135873073…), to set the CC var correctly. I don’t really understand why it needed it, but it did.

I’ve added Readlinehttp://cnswww.cns.cwru.edu/php/chet/readline/… here, but I don’t think it’s strictly necessary. I’ve also put all the libs in ENV variables - I like to do things tidily and not use /usr/local, the Apple wayhttps://developer.apple.com/library/mac/docum… of doing things is so much better - so feel free to point those vars wherever you need them to:

Readline 6.3

env CC="$(which gcc) -m64" ./configure --prefix=/Library/Frameworks/Readline.framework/Versions/6.3
sudo make install

OpenSSL 1.0.1h

./Configure --prefix=/Library/Frameworks/Openssl.framework/Versions/1.0.1h zlib-dynamic shared enable-cms darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
make depend
make test
sude make install

The ENV vars


Ruby 2.1.2

../ruby-2.1.2/configure --prefix=$MY_RUBY_INSTALL_DIR --with-openssl-dir=$MY_OPENSSL --with-gcc=$(which gcc) --with-readline-dir=$MY_READLINE
sudo make install

and now I have a working Ruby 2.1.2 in /opt/rubies/ruby-2.1.2!

Added on:
Info:- Ruby 2.1.2 - OpenSSL 1.0.1h - OSX 10.6.8 - zsh 4.3.9