Stok Footage

Continually experimenting with new ideas and techniques — Reconstructing, Developing, Modernising.

Building Ruby 1.8.7-p374 on Mountain Lion (and Mavericks) under rbenv

New versions of ruby 1.8.7, 1.9.3, and 2.0.0 came out recently to fix a security issue, and for the first time I have tried building an old (1.8.x) on OS X 10.8.4 (Mountain Lion).

I tried rbenv install 1.8.7-p374, and it ended like this:

Installing ruby-1.8.7-p374...

BUILD FAILED

Inspect or clean up the working tree at /var/folders/f3/6zk_yypd73jc88n1p6ww2f_00000gn/T/ruby-build.20130628064809.97811
Results logged to /var/folders/f3/6zk_yypd73jc88n1p6ww2f_00000gn/T/ruby-build.20130628064809.97811.log

Last 10 log lines:
tcltklib.c:9862: error: expected ‘;’ before ‘event’
tcltklib.c:9892: error: ‘struct dummy_TkMenu’ has no member named ‘menuType’
tcltklib.c:9897: error: ‘struct dummy_TkMenu’ has no member named ‘menuType’
tcltklib.c:9915: error: ‘event’ undeclared (first use in this function)
tcltklib.c:9916: error: ‘ConfigureNotify’ undeclared (first use in this function)
tcltklib.c:9917: error: ‘Tk_FakeWin’ has no member named ‘display’
tcltklib.c:9919: error: ‘Tk_FakeWin’ has no member named ‘window’
tcltklib.c:9920: error: ‘Tk_FakeWin’ has no member named ‘display’
make[1]: *** [tcltklib.o] Error 1
make: *** [all] Error 1

As X11 is no longer part of the OS I had to install XQuartz to get the X11 headers and libraries installed, and I needed to add CPPFLAGS=-I/opt/X11/include/ to the command line:

1
CPPFLAGS=-I/opt/X11/include/ rbenv install 1.8.7-p374

This worked fine, the only other change I needed to make was to comment out pry-plus from my ~/.rbenv/default-gems to build and install this old version of ruby.

I hope this helps somebody out there save a couple of minutes!

(Edited 2013-10-26 to include Mavericks in the title and body, as it works on that too)

4 Responses to “Building Ruby 1.8.7-p374 on Mountain Lion (and Mavericks) under rbenv”

  1. James says:

    This helped me a great deal! Thank you for writing it up!

  2. Alex Ross says:

    Thank you. Just what i needed.

  3. Conor Breen says:

    Thank you, helped me too.

  4. Steve Jorgensen says:

    Perfect. I already had XQuartz installed, but needed the `CPPFLAGS=-I/opt/X11/include/` environment variable setting.

Leave a Reply

Your email address will not be published. Required fields are marked *