Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install Ruby 1.8.7 on Mac OSX 10.12 Sierra with rbenv
# The main issues with Ruby 1.8.7 are that it won't build with Clang,
# and the Net::HTTPS module won't work with modern versions of OpenSSL.
# This assumes you have already set up homebrew, and run: xcode-select --install
brew install homebrew/dupes/apple-gcc42
brew install libyaml libffi
brew install
export CC=/usr/local/bin/gcc-4.2
export CFLAGS='-g -O2'
export RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl098
export CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/openssl098
rbenv install 1.8.7-p375
# Important gems:
# Rake is not installed by default, but you should start with a very old version before installing 10+:
gem install rake -v 0.7.3 # needed for very old Rails sites and some old gems to install
gem install slimgems # needed for Rails 1 + 2 to install
# if you want the latest rdoc for 1.8:
gem install rdoc -v 3.12.2
gem install rdoc-data -v 3.12
rdoc-data --install
# as of this writing, the latest version of bundler, 1.14.5, was still backwards compatible with Ruby 1.8
gem install bundler
# The following gem versions are known to be the last working 1.8 versions:
# gem 'rack', '~> 1.1.0'
# gem 'pg', '~> 0.17.1'
# gem 'i18n', '0.6.11'
# gem 'money', '4.0.2'
# gem 'nokogiri', '~> 1.5.10'
# gem 'activemerchant', '~> 1.43.2'
# gem 'httpclient', '~> 2.7.0'
Copy link

wmakley commented Feb 24, 2017

Added more information about what gems to install, and the most recent versions I've found that worked on 1.8. Also some small tweaks I encountered trying this from scratch in Sierra.

Copy link

ghost commented Oct 27, 2017

I get an error on El Sierra,10.12.6

$uname -a
Darwin localhost 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

$brew install homebrew/dupes/apple-gcc42
Warning: Use apple-gcc42 instead of deprecated homebrew/dupes/apple-gcc42
apple-gcc42: This formula either does not compile or function as expected on macOS
versions newer than Mavericks due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.

Copy link

OBCENEIKON commented Nov 1, 2017

+1 @synaxin

Copy link

MPvdBurg commented Nov 27, 2017

+1 @synaxin

Copy link

rteeuwen commented Jan 3, 2018

+1 @synaxin

Copy link

estevaoam commented Jul 17, 2019

If you're in the unfortunate journey of installing these legacy versions, I'm using rvm and managed to install the 1.8.7 on Sierra with this command:

rvm install 1.8.7 --with-gcc=clang

Copy link

wmakley commented Aug 10, 2019

Thanks @estevaom! My instructions stopped working for me completely and I have just been Docker. To everyone referring to my gist, please note that it certainly does not work any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment