Where Does rbenv Install Rubies and Shims?
Where rbenv installs Ruby versions, gems, and shims on macOS and Linux, and the files that select them.
Last updated
rbenv roots its whole world at ~/.rbenv. Every Ruby version gets its own folder under versions/, gems stay inside their Ruby, and a shims directory routes commands to the right one.
Which Ruby runs is decided by tiny version files, not by the installs themselves. A .ruby-version file in the project pins the repo, while ~/.rbenv/version sets your personal default. Commit the first, never the second. The versions command lists installed Rubies with the active one marked. Plugins add commands under plugins/ without touching the core layout.
Where rbenv stores this, by platform
~/.rbenv
Homebrew installs the rbenv tool itself into /opt/homebrew but Rubies still land in ~/.rbenv/versions. RBENV_ROOT relocates the tree if home is cramped. Shell init (rbenv init) must run for shims to take effect.
~/.rbenv
Same layout: versions/, shims/, plugins/, and version all directly under ~/.rbenv. Package manager installs and git checkouts behave identically once RBENV_ROOT points at this folder. Gems for each Ruby sit inside its versions subfolder.
Frequently asked questions
where does rbenv store the selected version
In a .ruby-version file in the project root, or the global version file at ~/.rbenv/version. rbenv checks the current directory upward, so the nearest .ruby-version wins. rbenv local and rbenv global write these files for you.
where are rbenv rubies installed
Under ~/.rbenv/versions, one folder per Ruby (for example 3.3.4/). Each has its own gems directory, which is why gem sets never leak across Rubies. Delete a version folder only via rbenv uninstall to keep shims consistent.
where are rbenv shims
In ~/.rbenv/shims, regenerated by rbenv rehash. Your PATH must list shims before system Ruby. If ruby -v ignores .ruby-version, the shims directory is usually missing from PATH or a stale shell needs reopening.
Notice an outdated path? Let us know.