rbenv: 安装 ruby
安装 rbenv 的基本步骤
01 准备 openssl@1.1
安装 openssl
brew install openssl@1.1
安装完之后,设置环境变量
export LDFLAGS=-L/opt/homebrew/opt/openssl@1.1/lib
export CPPFLAGS=-I/opt/homebrew/opt/openssl@1.1/include
其它详情信息
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/opt/homebrew/etc/openssl@1.1/certs
and run
/opt/homebrew/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.profile
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
02 安装 mysql-client
安装准备
brew install mysql-client
设置变量
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig"
其它重要信息
mysql-client is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with mysql (which contains client libraries).
If you need to have mysql-client first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.profile
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"
For pkg-config to find mysql-client you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig"
==> Summary
🍺 /opt/homebrew/Cellar/mysql-client/9.0.1: 120 files, 125.8MB
==> Running `brew cleanup mysql-client`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> mysql-client
mysql-client is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with mysql (which contains client libraries).
If you need to have mysql-client first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.profile
For compilers to find mysql-client you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include"
For pkg-config to find mysql-client you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig"
03 提前缓存3.2.2版
wget 下载
## prepare package
mkdir -p ~/.rbenv/cache
cd ~/.rbenv/cache
# 2.3.3
wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.3.tar.bz2
## 2.6.5
wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
## 2.7.0
wget https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.0.tar.bz2
## 3.2.2
brew install libyaml
wget https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
rbenv install 3.2.2
gem install bundler
gem install whenever
gem install rails
## install<cwd: ~/.rbenv/cache>
rbenv install 2.3.3
04 安装已缓存的ruby
安装 3.2.2 版本
# 安装
rbenv install 3.2.2
# 设置为全局
rbenv global 3.2.2
# 或者
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.1" rbenv install 3.0.4