参考: rbenv
1 2 3 4 5 6 7 8 9 10 11
| # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install rbenv and ruby-build brew install rbenv
# Set up rbenv integration with your shell rbenv init
# Check your installation curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
|
配置 .zshrc
1 2
| # rbenv eval "$(rbenv init - zsh)"
|
Restart your terminal to apply your changes. Next, you can install the Ruby version you want. Let’s install the latest stable version:
1 2 3 4
| rbenv install 3.0.0 rbenv global 3.0.0 ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468)
|