I've recently decided to look at an old Rails app running Ruby 1.9.2 and decided to try to install 1.9.2 on my macOS 10.13 machine.
I'm aware that gcc no longer ships with macOS so I remembered the old trick of using Homebrew Core's apple-gcc42
recipe, sadly the maximum version this works with is 10.9 (Mavericks). I tried my luck anyway and even followd rbenv's gcc compatibility notes:
(Note that Ruby < 2.0 does not have the with-readline-dir flag; use with-opt-dir instead.)
I tried the following command (note that I have rbenv's ruby-build plugin installed and up-to-date):
RUBY_CONFIGURE_OPTS="--with-opt-dir=/usr/local/opt/" CC=/usr/local/bin/gcc-4.2 rbenv install 1.9.2-p180
ruby-build: use libyaml from homebrew
Downloading ruby-1.9.2-p180.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.bz2
Installing ruby-1.9.2-p180...
WARNING: ruby-1.9.2-p180 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.13.3 using ruby-build 20180329)
Inspect or clean up the working tree at /var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949
Results logged to /var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949.log
Last 10 log lines:
/var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949 /usr/local/bin
/var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949/ruby-1.9.2-p180 /var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949 /usr/local/bin
configure: WARNING: unrecognized options: --with-openssl-dir, --with-libyaml-dir, --with-readline-dir
checking build system type... i386-apple-darwin17.4.0
checking host system type... i386-apple-darwin17.4.0
checking target system type... i386-apple-darwin17.4.0
checking whether the C compiler works... no
configure: error: in `/var/folders/0t/hft4_1h13wqd91mwcw2j94h80000gn/T/ruby-build.20180407090310.93949/ruby-1.9.2-p180':
configure: error: C compiler cannot create executables
See `config.log' for more details
The error on the config.log is the same as the one output above:
configure:3446: error: C compiler cannot create executables
I tried to compile a basic file with C code and gcc-4.2
failed to do so (unlike /usr/local/bin/gcc
) which I tells me gcc-4.2
simply doesn't work on macOS 10.13 right now. Perhaps the only way forward would be to find a way to compile old Rubies with modern gcc versions, but I'm guessing that might involve making a lot of manual changes to the configure
files to make them compatible.
I'm just curious if anyone's succeeded in this endeavor or if this is a lost cause.