# rbenv vs RVM: Ruby バージョンの管理

> rbenv vs RVM: shim ベースのミニマルな Ruby バージョンマネージャと、gemset を備えたフル機能版。フットプリント、機能、CI への適合を比較。

Source: https://latchkey.dev/ja/learn/tool-comparisons/rbenv-vs-rvm  
Updated: 2026-06-26

rbenv は軽量な shim ベースの Ruby バージョン切り替えツール。RVM はより重く、gemset とシェル統合を同梱します。

rbenv は1つのことだけを行います - shim と .ruby-version ファイルでプロジェクトごとに Ruby バージョンを選択し、gem や build の懸念は ruby-build のようなプラグインに委ねます。RVM はより包括的で、cd コマンドを上書きし、gemset を管理し、幅広いシェル統合を提供します。rbenv は小さく予測可能なフットプリントで好まれ、RVM は複雑さと引き換えに多くの機能を組み込みで提供します。

## Comparison

|  | rbenv | RVM |
| --- | --- | --- |
| アプローチ | shim、ミニマル | シェル関数、フル機能 |
| gemset | プラグイン経由 (Bundler) | 組み込み |
| フットプリント | 軽量 | より重い |
| 設定ファイル | .ruby-version | .ruby-version / .rvmrc |
| 最適な用途 | ミニマル、組み合わせ可能 | オールインワン機能 |

## CI では

rbenv は CI でシンプルかつ予測可能で、ruby-build がインストールを、Bundler が分離を担います。RVM も動作しますが、そのシェルの上書きは非対話的な runner で扱いにくいことがあります。多くのパイプラインは代わりに setup-ruby を使います。ローカルのパリティでは rbenv がより軽く、RVM がより機能豊富な選択肢です。

## 高速化

.ruby-version と Gemfile.lock をキーに、build 済みの Ruby と gem の cache を保存しましょう。どちらも CI runner 上で動作し、より高速なマネージド runner は Ruby の build と bundle install の手順を短縮します。

## Decide with your own numbers, not a feature table

Feature comparisons age badly and rarely decide anything, because both tools in a mature category can do the job. What differs is how each behaves on your repository, and that takes one afternoon to measure.

```Terminal
# time a cold install with each candidate, cache cleared
hyperfine --prepare "rm -rf node_modules" --warmup 1 \
  "<tool-a> install" "<tool-b> install"

# and the thing CI actually pays for: a cold run with no local cache
docker run --rm -v "$(pwd):/w" -w /w node:22 sh -c "<tool> install"
```

> Measure the cold path. Warm local benchmarks favour whichever tool you already have cached, which is exactly the condition a CI runner never has.

## What actually changes when you switch

- Lockfile format. A switch is a one-way door for anyone still on the old tool until everyone migrates, so plan it as a single coordinated change.
- Resolution strictness. Tools differ on whether an undeclared transitive import works, and the stricter one will surface latent bugs as new failures.
- CI cache configuration. The cache path and key differ per tool; carrying over the old ones silently disables caching.
- Everyone on the team and every runner must move together. Pin the version so they cannot drift.

## 結論

Bundler とうまく協調するミニマルで組み合わせやすい Ruby 切り替えツールがほしいなら rbenv。組み込みの gemset と幅広いシェル統合を1つのツールでほしいなら RVM。モダンなチームはシンプルさから rbenv（または chruby）に傾き、RVM は古いセットアップで依然一般的です。

## FAQ

### rbenv vs RVM: Managing Ruby Versions?

rbenv does one thing - select a Ruby version per project via shims and a .ruby-version file - and leaves gem and build concerns to plugins like ruby-build. RVM is more all-encompassing, overriding the cd command, managing gemsets, and offering broad shell integration.

### In CI?

rbenv is simple and predictable in CI, with ruby-build handling installs and Bundler handling isolation. RVM works but its shell overrides can be fiddly in non-interactive runners. Many pipelines use setup-ruby instead; for local parity rbenv is the lighter choice and RVM the more feature-complete one.

### Speed it up?

Cache the built Ruby and the gem cache keyed on .ruby-version and Gemfile.lock. Both run on CI runners; faster managed runners shorten the Ruby build and bundle install steps.

### Which should I choose?

Wanting a minimal, composable Ruby switcher that plays well with Bundler: rbenv. Wanting built-in gemsets and broad shell integration in one tool: RVM. Modern teams lean rbenv (or chruby) for simplicity; RVM remains common on older setups.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
