Install Ruby on macOS with Version Manager โ
Outline โ
brew install rbenv โ
shell
brew install rbenv ruby-buildSetup Paths โ
bash โ
shell
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profilezsh โ
shell
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zprofile
echo 'eval "$(rbenv init -)"' >> ~/.zprofileCommands โ
list all available versions โ
shell
rbenv install -linstall a Ruby version โ
shell
rbenv install 3.1.2
rbenv install 2.1.4set ruby version for a specific dir โ
shell
rbenv local 2.1.4set ruby version globally โ
shell
rbenv global 3.1.2
rbenv rehash
gem update --systemDebugging โ
rbenv install 3.1.2
Bug 1 โ
Problem: Could not install a ruby version
shell
brew install openssl libffi zlib readlineBug 2 โ
Error: You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
Solution:
- Deleted the
Gemfile.lock - Run
bundle