rbenv is a version manager for the Ruby programming language on Unix-like systems. It lets you switch between multiple installed Ruby versions on one machine and keeps each project on the version it expects. It works by injecting itself into your PATH, then reading a .ruby-version file in the current directory to pick the Ruby version from those installed under /.rbenv/versions/.
Install & use
Install
brew install rbenv
Usage
rbenv local 3.1.2
rbenv/rbenv is a third-party open-source project, listed here from public GitHub data. ImuTechz did not write it and has not reviewed or security-audited its code. Read the source and its permissions before you install or run it.
Features
Switches Ruby versions per project via a .ruby-version file
Hooks into your shell PATH so ruby, gem and bundler use the selected version
Stores installed Ruby versions under /.rbenv/versions/
Almost every part is customizable through bash plugins
Shell completions for bash and zsh
rbenv install is provided by the separate ruby-build plugin
Best for
Running different Ruby versions across multiple projects
Pinning a project to a specific Ruby version
Managing several Ruby installs on one machine
Pros
Simple mechanism that is customizable via bash plugins
Automatically selects the right Ruby version when you change directories
Can be installed through package managers or a basic git checkout
Cons
rbenv install does not ship with rbenv; it requires the ruby-build plugin
The Debian and Ubuntu packaged version is stated to be out of date
Installing Ruby requires a build environment with the necessary tools and libraries
A delightful community-driven (with 2,500+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub…