1. Use homebrew to install rbenv
brew install rbenv
2. Explanation of common commands
rbenv install -- list #List all ruby versions rbenv install two . zero -p247 #Install the required ruby version rbenv versions #All installed ruby versions rbenv global one point eight . seven -p352 #Set global ruby version rbenv local one point nine . seven #Set the ruby version of the current folder rbenv uninstall two #Uninstall the specified ruby version
3. Install ruby
rbenv install two point seven . zero
rbenv shell two point seven . zero
$ ruby -v ruby two point seven .0p0 ( two thousand and nineteen - twelve - twenty-five revision 647ee6f091) [x86_64-darwin20] $ which ruby /Users/lee980/.rbenv/shims/ruby