Your Gemfile.lock only lists the platform you developed on (often arm64-darwin), so on the Linux CI runner Bundler has no x86_64-linux entry for a platform-specific gem and the install fails.
What this error means
bundle install passes locally on macOS but fails on the Linux runner - Bundler cannot find a gem (often nokogiri, sqlite3, or grpc) for x86_64-linux, or reports the lockfile does not include that platform.
bundler output
Could not find nokogiri-1.16.0-x86_64-linux in locally installed gems
# the lockfile PLATFORMS section only lists:
PLATFORMS
arm64-darwin-23
Diagnose it: Ruby version and platform
Bundler resolves against the Ruby version and the platform recorded in the lockfile. A runner on a different Ruby or a Linux platform missing from Gemfile.lock fails in a way that names a gem rather than the cause.
Terminal
ruby -v && bundle -v
cat .ruby-version 2>/dev/null
bundle platform
# the usual CI-only failure: Linux platform absent from the lockfile
bundle lock --add-platform x86_64-linux
bundle install --jobs 4 --retry 3
Common causes
Lockfile generated on one platform only
A lockfile created on macOS records only the Darwin platform. Precompiled gems shipped per-platform have no x86_64-linux variant locked, so Linux CI cannot resolve them.
Precompiled native gems are platform-pinned
Gems like nokogiri ship separate precompiled builds per platform. Without the Linux platform in the lockfile, Bundler will not pick the Linux build.
How to fix it
Add the Linux platform to the lockfile
Record the platforms your CI runs on, then commit the updated lockfile.
Confirm the PLATFORMS section now lists the runner architecture.
Terminal
grep -A4 PLATFORMS Gemfile.lock
How to prevent it
Run bundle lock --add-platform for every OS/arch your CI uses.
Commit the multi-platform Gemfile.lock so all runners resolve the same gems.
Add x86_64-linux-musl when using Alpine-based images.
Frequently asked questions
What causes Bundler missing platform gem (x86_64-linux) in CI?
There are 2 common causes: lockfile generated on one platform only and precompiled native gems are platform-pinned. A lockfile created on macOS records only the Darwin platform.
How do I fix Bundler missing platform gem (x86_64-linux) in CI?
There are 2 fixes depending on which cause you have: add the linux platform to the lockfile and verify the locked platforms. Work through them in order, since the first is the most common.
What does Bundler missing platform gem (x86_64-linux) in CI actually mean?
bundle install passes locally on macOS but fails on the Linux runner - Bundler cannot find a gem (often nokogiri, sqlite3, or grpc) for x86_64-linux, or reports the lockfile does not include that platform.
How do I stop Bundler missing platform gem (x86_64-linux) in CI happening again?
Run bundle lock --add-platform for every OS/arch your CI uses. The prevention section lists 3 changes that keep it from recurring.