Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jcchikikomori/f7deb12ea72608dcfb7fbacb9ea1104b to your computer and use it in GitHub Desktop.
Save jcchikikomori/f7deb12ea72608dcfb7fbacb9ea1104b to your computer and use it in GitHub Desktop.
Installing Ruby 2.5 on Linux (using Homebrew)

Forked from the guide for M1. But on Linux, since Ruby 2.5 is already a legacy build.

I installed readline and openssl with standard brew install.

brew install readline
HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]
brew install gcc@13

Then I set this in my ~/.zshrc..

# Homebrew
export PATH=$HOMEBREW_PREFIX/bin:$PATH
export PATH="$HOMEBREW_PREFIX/sbin:$PATH"
# rbenv
export RBENV_ROOT=$HOMEBREW_PREFIX/opt/rbenv
export PATH=$RBENV_ROOT/bin:$PATH
eval "$(rbenv init -)"
# openssl
export PATH="$HOMEBREW_PREFIX/opt/[email protected]/bin:$PATH"
export LDFLAGS="-L$HOMEBREW_PREFIX/opt/[email protected]/lib"
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/[email protected]/include"
export PKG_CONFIG_PATH="$HOMEBREW_PREFIX/opt/[email protected]/lib/pkgconfig"
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/[email protected]"
# gcc 13
export PATH="$HOMEBREW_PREFIX/opt/gcc@13/bin:$PATH"
export LDFLAGS="-L$HOMEBREW_PREFIX/opt/gcc@13/lib"
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/gcc@13/include"

Then I ran this command (which is not working anymore):

RUBY_CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 2.5

If it doesn't work, try using this by installing different build.

RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.5.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment