いまさらRuby 1.8.7?ですが、古いアプリをメンテする時には必要なので。…そんな時こそrbenvですよね。

しかし、MacにrbenvでRuby 1.8.7を入れようとしたらエラー。

% rbenv install 1.8.7-p371
Downloading ruby-1.8.7-p371.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p371.tar.gz
Installing ruby-1.8.7-p371...

BUILD FAILED
Inspect or clean up the working tree at /var/folders/lv/gvfd8wg91dn88yzwndwsnwsm0000gn/T/ruby-build.20130408155951.36493
Results logged to /var/folders/lv/gvfd8wg91dn88yzwndwsnwsm0000gn/T/ruby-build.20130408155951.36493.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
zsh: exit 1

結論としては、↓ こうやったらインストールできました。

% CONFIGURE_OPTS="--without-tk" rbenv install 1.8.7-p371