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