I bought a new mac and had the opportunity to recreate the Ruby environment, so I will summarize it as a memorandum.
First, install homebrew. (People who have already installed it are okay)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Run this command in the terminal to complete the installation.
Install wget.
brew install wget
After installing wget, we will start installing Ruby. As a procedure --Install rbenv with homebrew --Pass --Installing ruby I feel said. Now, let's install rbenv.
brew install rbenv
brew install ruby-build
Execute these two commands to install. After the installation is complete, go through the path.
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
source ~/.zshrc
You have now passed the rbenv installation and path. Finally, I will install Ruby.
rbenv install --list
rbenv install 2.6.6
rbenv rehash
rbenv global 2.6.6
You can check the list of Ruby versions that can be downloaded with the first command. Specify the version of Ruby to download with the second command. (I chose 2.6.6 this time) The third command reloads rbenv, and the fourth command specifies the version to use by default.
After all the work is done, at the terminal
ruby -v
Please check if you have the version you specified earlier. If not, the path may not be working properly, so please check zshrc.
Recommended Posts