Create a gist now

Instantly share code, notes, and snippets.

Embed
Install Ruby 1.8.7 on Mac OSX 10.12 Sierra with rbenv
#!/bin/sh
# 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 https://github.com/Homebrew/homebrew-versions/raw/586b7e9012a3ed1f9df6c43d0483c65549349289/openssl098.rb
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'
@wmakley

This comment has been minimized.

Show comment
Hide comment
@wmakley

wmakley Nov 3, 2016

Just FYI I actually haven't tested this fully in Sierra, it worked in El Capitan though. This is a fusion of the original gist creator's script, and various tips I have found around the internet that worked for me, including this blog post: https://yous.be/2016/04/16/installing-ruby-1-8-7-on-os-x-el-capitan/

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 (it will build, you will just get errors when trying to make an https request).

Owner

wmakley commented Nov 3, 2016

Just FYI I actually haven't tested this fully in Sierra, it worked in El Capitan though. This is a fusion of the original gist creator's script, and various tips I have found around the internet that worked for me, including this blog post: https://yous.be/2016/04/16/installing-ruby-1-8-7-on-os-x-el-capitan/

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 (it will build, you will just get errors when trying to make an https request).

@nerdinand

This comment has been minimized.

Show comment
Hide comment
@nerdinand

nerdinand Dec 17, 2016

Seems to work for me on macOS Sierra 10.12.1. Thanks so much!

Seems to work for me on macOS Sierra 10.12.1. Thanks so much!

@wmakley

This comment has been minimized.

Show comment
Hide comment
@wmakley

wmakley 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.

Owner

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.

@synaxin

This comment has been minimized.

Show comment
Hide comment
@synaxin

synaxin 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.

synaxin 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.

@OBCENEIKON

This comment has been minimized.

Show comment
Hide comment
@ThijsvandenBurg

This comment has been minimized.

Show comment
Hide comment

ThijsvandenBurg commented Nov 27, 2017

@rteeuwen

This comment has been minimized.

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