用 rbenv 来安装ruby

参考: rbenv

# 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

# 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:

rbenv install 3.0.0
rbenv global 3.0.0
ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468)

你可能感兴趣的:(用 rbenv 来安装ruby)