Installing Ruby 2.x on OS X Failing On Maverick

Context

  • Mac OS X 10.9 (Mavericks)
  • Managing OS packages with Brew
  • Installing Ruby with rbenv

Symptoms

$ rbenv install 2.0.0-p451
Downloading ruby-2.0.0-p451.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/9227787a9636551f1749ee8394b5ffe5
Installing ruby-2.0.0-p451...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/v_/sbnsm31x3wl0jxkdq6cbsjbr0000gn/T/ruby-build.20140522114159.66959
Results logged to /var/folders/v_/sbnsm31x3wl0jxkdq6cbsjbr0000gn/T/ruby-build.20140522114159.66959.log

Last 10 log lines:
compiling ossl_x509req.c
compiling ossl_x509revoked.c
linking shared-object nkf.bundle
compiling ossl_x509store.c
installing default openssl libraries
1 warning generated.
linking shared-object date_core.bundle
linking shared-object openssl.bundle
linking shared-object ripper.bundle
make: *** [build-ext] Error 2

old_thread_select.c:57:10: warning: 'rb_thread_select' is deprecated [-Wdeprecated-declarations]
    rc = rb_thread_select(max, rp, wp, ep, tvp);
         ^
../../.././include/ruby/intern.h:417:16: note: 'rb_thread_select' declared here
DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
               ^
../../../.ext/include/x86_64-darwin13.2.0/ruby/config.h:92:52: note: expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
linking shared-object -test-/num2int/num2int.bundle

Diagnosis

OpenSSL library that was in effect (wasn't able to determine from where: system-provided? previously installed with brew?) was incompatible with the Ruby build.

Prescription

1. After ensuring that Brew libraries are up-to-date…

$ brew update

2. Remove any previously brew-installed copy of openssl:

$ brew uninstall openssl

3. Ensure you have the latest of ruby-build

$ brew upgrade ruby-build
  1. updated Xcode to the latest (5.1) (open the IDE for it to install cmd-line tools) *

$ xcode-select —install

$ brew install openssl
$ brew link —force openssl (open new terminal)
$ rbenv rehash
$ rbenv install 2.0.0-p451 (note: THIS is what installed openssl).

ensure that the following two lines are in your ~/.bash_profile (and verify the paths are correcT)
export PATH="$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"

  • re: steps around jostling the "openssl" keg may be optional (but the brew link —force is not)

Postgres Encoding Issue

On our image, we have a template database with ASCII encoding. Needs to be UTF-8.

Here's how…

(shutdown postgres)
$ cd /usr/local/var
$ rm -rf postgres
$ brew install postgres
$ launchctl load (blah..blah; as instructed)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License