rbenv is a lightweight Ruby version manager that lets you switch between different Ruby versions across projects without modifying system binaries.
Version Management
# List all installable Ruby releases
rbenv install -l
# Install specific Ruby version via ruby-build
rbenv install 3.3.0
# List installed Ruby versions
rbenv versions
# Check currently active Ruby version
rbenv version
# Rehash shims after installing new gems with binaries
rbenv rehash
Setting Ruby Versions
| Command | Scope | Description |
|---|---|---|
rbenv local 3.3.0 |
Local directory | Writes .ruby-version file in current folder |
rbenv global 3.3.0 |
System user | Sets default fallback in ~/.rbenv/version |
rbenv shell 3.3.0 |
Current terminal | Sets RBENV_VERSION environment variable |
rbenv local --unset |
Revert local | Removes local directory .ruby-version |
Shims & Path Inspection
# Display full path to the executable active in current Ruby
rbenv which gem
rbenv which rake