Skip to content

Instantly share code, notes, and snippets.

@dbernheisel
Last active September 20, 2020 14:58
Show Gist options
  • Select an option

  • Save dbernheisel/24b6873917556b4362150414c322263b to your computer and use it in GitHub Desktop.

Select an option

Save dbernheisel/24b6873917556b4362150414c322263b to your computer and use it in GitHub Desktop.
Installing old Ruby with old OpenSSL requires a couple flags. Here they are.
# Install prerequisites. I'm using arch, but you can do similar things with brew but paths change.
yay gcc6
pacman -S openssl-1.0
OPENSSL_DIR="/usr/lib/openssl-1.0"
# If you're on mac and installed with brew, you can do this:
# OPENSSL_DIR=$(brew --prefix openssl-1.0)
# A patch to let older Ruby to work with newer OpenSSL
SSL_PATCH="https://gist.github.com/mislav/055441129184a1512bb5/raw"
# Install Ruby with old OpenSSL. asdf and rbenv both use ruby-build, so look at
# ruby-build's docs for more info: https://github.com/rbenv/ruby-build
# if you're using asdf
CC=/usr/bin/gcc-6 \
PKG_CONFIG_PATH=$OPENSSL_DIR/pkgconfig \
RUBY_APPLY_PATCHES=$(curl -s $SSL_PATCH) \
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$OPENSSL_DIR" \
asdf install ruby 2.1.8
# if you're using rbenv
# CC=/usr/bin/gcc-6 \
# PKG_CONFIG_PATH=/usr/lib/openssl-1.0/pkgconfig \
# RUBY_CONFIGURE_OPTS="--with-openssl-dir=$OPENSSL_DIR" \
# rbenv install --patch 2.1.8 < <(curl -sSL $SSL_PATCH)
# In your Ruby app folder. install your gems that need help first, then run bundle
gem install bundler -v 1.17.3
gem install puma -v '3.6.0' -- --with-cppflags=-I$OPENSSL_DIR --with-ldflags=-L$OPENSSL_DIR
bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment