安装 ruby 2.3.3
小于2.4的版本都按此方法进行
第一步: 安装 openssl@1.0
brew install rbenv/tap/openssl@1.0
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl@1.0/bin/c_rehash
openssl@1.0 is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl@1.0 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openssl@1.0/bin:$PATH"' >> ~/.profile
For compilers to find openssl@1.0 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include"
For pkg-config to find openssl@1.0 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.0/lib/pkgconfig"
==> Summary
🍺 /usr/local/Cellar/openssl@1.0/1.0.2t: 1,787 files, 12.4MB, built in 7 minutes 40 seconds
第二步: 安装 rbenv
brew install rbenv
第三步: 放一些临时的环境变量
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"
第四步: 安装 ruby2.3.3
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.0)" rbenv install 2.3.3
看到下面就表示安装成功了
Installing ruby-2.3.3...
WARNING: ruby-2.3.3 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-2.3.3 to /Users/alo7.aric/.rbenv/versions/2.3.3