Ruby 1.9.3 安装

很老的系统,用到这个,在 macos 上的安装过程
更新于: 2021-12-19 12:57:29

先添加一些临时的环境变量

# 这个最重要
export CFLAGS="-Wno-error=implicit-function-declaration"

# 这些是2.4以下安装时候需要添加的
export PATH="/usr/local/opt/openssl@1.0/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"

下载好 ruby 1.9.3-p551

cd ~/.rbenv/cach
wget https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p551.tar.bz2
❯ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" rbenv install 1.9.3-p551
ruby-build: using libyaml from homebrew
Installing ruby-1.9.3-p551...

WARNING: ruby-1.9.3-p551 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew
Installed ruby-1.9.3-p551 to /Users/alo7.aric/.rbenv/versions/1.9.3-p551

测试是否安装成功

❯ rbenv versions
  system
  1.9.3-p551
  2.3.3
  2.4.2