This time, I bought Junichi Ito's introduction to Ruby and started learning. I had to change the version of Ruby, so I looked into rbenv.
It is a tool that switches the version of Ruby. First of all, I would like to install rbenv.
Terminal
#Initialization settings
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
#Reflection of initialization settings
$ source ~/.bash_profile
#Install rbenv
$ brew install rbenv ruby-build
Installation is complete here. The following describes how to install the specified version of Ruby.
Terminal
#Display a list of installable Ruby versions
$ rbenv install -l
#Install the version of Ruby you want to install from the list
$ rbenv install 2.4.1
#Make the installed version of Ruby available
$ rbenv rehash
If you want to install multiple versions, you can repeat the above.
~ / .rbenv / (root folder) ~ / .rbenv / shims / (folder to save wrappers for commands installed by ruby and gem) ~ / .rbenv / version (file that records the globally set Ruby version) ~ / .rbenv / versions / (Folder to install other installed Ruby versions)
Source: What is rbenv-Qiita
Terminal
#Switch the version of Ruby used for the entire PC
$ rbenv global 2.4.1
#Check if it was installed
$ ruby -v
Recommended Posts