Skip to content

Instantly share code, notes, and snippets.

@meineerde
Last active October 6, 2021 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meineerde/84744448400ee49062a43b28a6ac5360 to your computer and use it in GitHub Desktop.
Save meineerde/84744448400ee49062a43b28a6ac5360 to your computer and use it in GitHub Desktop.
Install Ruby 1.8.7 on macOS Catalina with ruby-install
brew install rbenv/tap/openssl@1.0
brew install gcc@6
brew install ruby-install

"Patch" ruby-install:

$EDITOR /usr/local/Cellar/ruby-install/0.8.1/share/ruby-install/ruby/functions.sh

Set opt_dir="$(brew —prefix openssl@1.0)... (i.e. add the @1.0)

Now install Ruby 1.8.7

CC=gcc-6 CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls -I$(brew --prefix openssl@1.0)/include -I/opt/X11/include" LDFLAGS="-L$(brew --prefix openssl@1.0)/lib -L /opt/X11/lib" ruby-install ruby-1.8.7-p374 -u https://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz
@meineerde
Copy link
Author

meineerde commented Feb 24, 2021

Right now, you might also need an entry in /etc/hosts to pin rubygems to an IP which doesn't require SNI (which is not supported by the openssl library in Ruby 1.8.7):

# Pin rubygems.org to static IP without SNI requirement
# https://github.com/rubygems/rubygems/issues/4228#issuecomment-760802106
151.101.0.70     rubygems.org index.rubygems.org

Edit 2021-10-06: This is not needed anymore

@meineerde
Copy link
Author

With rbenv:

CC=gcc-6 RUBY_CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" LDFLAGS="-L$(brew --prefix openssl@1.0)/lib" CPPFLAGS="-I$(brew --prefix openssl@1.0)/include" rbenv install 1.8.7

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