Skip to content
Latchkey

Bundler Missing Platform Gem (x86_64-linux) in CI

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

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.

Terminal
bundle lock --add-platform x86_64-linux
bundle lock --add-platform ruby   # generic fallback
git add Gemfile.lock && git commit -m "Add x86_64-linux platform"

Verify the locked platforms

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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →