rbenv selects Ruby versions per directory on Unix-like systems via shims and a .ruby-version file. It integrates with shell init and optional ruby-build plugins.
Overview
rbenv is a version manager for the Ruby programming language on Unix-like systems. It lets one machine host multiple Ruby runtimes and pin each project to the interpreter version it needs, reducing conflicts between applications that expect different Rubies.
After installation hooks into the shell PATH, invocations of ruby, gem, bundler, and related executables pass through rbenv shims. The tool reads a .ruby-version file in the working directory when present, otherwise falls back to global or shell-specific settings. Switching directories therefore switches Ruby versions without manual path editing.
Users set local, global, or shell-scoped versions, list installed Rubies, and refresh shims when gems add binaries. Installing new Ruby interpreters is delegated to the separate ruby-build plugin rather than shipping with rbenv itself. Package managers such as Homebrew, Fedora, Arch, and OpenSUSE carry packages, and a git-based install path places files under the user home directory.
Behavior can be extended through bash plugins, and most workflow steps are exposed as small CLI subcommands. The design favors simplicity and explicit version files over system-wide Ruby replacements.
Key features
- Directory-based .ruby-version files
- Shimmed Ruby executables
- Local, global, and shell overrides
- Plugin-extensible bash hooks
- ruby-build integration for installs
- Shell completion scripts
- gem-aware shim rehashing
- Homebrew and distro packages
Use cases
- Isolating Ruby versions per app
- Switching Rubies between projects
- Avoiding system Ruby for gems
- Managing multiple legacy codebases