/errors/bundler/your-ruby-version-is-but-your-gemfile-specified
Your Ruby version is 3.2.2, but your Gemfile specified 3.3.0
- tool
- Bundler
- exit code
- 18
- versions
- Bundler 2.x
- os
- linux, macos, windows
Your Ruby version is 3.2.2, but your Gemfile specified 3.3.0 means the Gemfile pins a Ruby version with a ruby "3.3.0" line, and the ruby that runs Bundler is a different version. Bundler stops before installing or loading any gem. Switch to the required Ruby with your version manager (rbenv local 3.3.0, asdf set ruby 3.3.0, rvm use 3.3.0) and run bundle install again, or change the ruby line if the project should use your version.
Check which Ruby is active
ruby -v # the version Bundler sees
which ruby # is it the version manager's shim or /usr/bin/ruby?
cat .ruby-version # what the version manager should select
grep -n '^ruby' Gemfile # what Bundler requiresFix with a version manager
| Manager | Install | Select for this project |
|---|---|---|
| rbenv | rbenv install 3.3.0 | rbenv local 3.3.0 (writes .ruby-version) |
| asdf | asdf install ruby 3.3.0 | asdf set ruby 3.3.0 (writes .tool-versions; asdf before 0.16: asdf local ruby 3.3.0) |
| rvm | rvm install 3.3.0 | rvm use 3.3.0 |
| chruby + ruby-install | ruby-install ruby 3.3.0 | chruby 3.3.0 (or auto-switch with .ruby-version) |
After switching, install the gems for that Ruby (each Ruby version has its own gem directory):
gem install bundler # if this Ruby has no Bundler of the version in Gemfile.lock
bundle installOne source of truth
source "https://rubygems.org"
ruby file: ".ruby-version" # read the version from .ruby-versionWith this form, the version lives only in .ruby-version, which version managers and CI setup actions already read. On older Bundler versions use ruby "3.3.0" and keep both files identical. Gemfile.lock also records the Ruby version under RUBY VERSION.