Safeguard
Supply Chain•

How do you pin fastlane in CI with Bundler?

Your release automation is software too. Pin fastlane with a Gemfile and committed Gemfile.lock, run it with bundle exec, and update it on purpose.

Safeguard Security Team
4 min read

Add a Gemfile that names fastlane, commit both the Gemfile and Gemfile.lock, install with Bundler on CI, and run every lane through bundle exec. Then the automation that holds your signing and store credentials runs the exact gem versions you reviewed, and changes only when you run an update.

Why this matters

The release tool runs with your most sensitive credentials. If a new gem version arrives silently between two builds, you have changed code that can read the store key, with no review. A lockfile turns that into a visible diff.

What the documentation recommends

The fastlane setup guide recommends Bundler and a Gemfile to define the dependency on fastlane. It says this clearly defines the fastlane version and its dependencies and also speeds up execution. Its steps are:

  1. Install Bundler.
  2. Create a Gemfile with the RubyGems source and gem "fastlane".
  3. Run bundle update, and add both the Gemfile and Gemfile.lock to version control.
  4. Run fastlane with bundle exec fastlane and the lane name.
  5. On CI, run bundle install as the first build step.
  6. To update fastlane, run bundle update fastlane.

The same page says system Ruby is not recommended because dependencies can conflict, and that using sudo with gem installs often leads to permission trouble later. It also states supported Ruby versions, so check the current page when you pick one for CI.

What the lockfile gives you

Without a lockfileWith a committed lockfile
Newest matching gems on each runSame versions each run
A bad release can arrive unseenUpdates are a reviewed diff
Hard to say what ran for build 412The lockfile at that commit says

The Ruby deployment guide adds that you should commit the Gemfile and Gemfile.lock, and install the bundle so the app uses the exact same gems as in development.

Update on purpose

Schedule a regular update, for example monthly, and do it in a branch:

  1. Run the update and read the changed lines in Gemfile.lock.
  2. Look up release notes for anything with a major version change.
  3. Run the beta lane against a test app first.
  4. Merge, and note the date.

If an advisory lands for a gem, you can update immediately and have a clear record of when.

Related pins in the pipeline

The tool is only one input. Pin the CI actions or plugins your workflow calls, pin the Xcode or JDK version, and keep Ruby on a managed version. Our post on fastlane Fastfile changes as code review covers the file that drives it all.

Audit the gems you run

Treat the lockfile as an inventory. Running a Ruby advisory check against it in CI catches known vulnerable gems. Our existing post on bundler lockfile practices is a good companion.

Try it yourself

Open the demo and look at how a lockfile turns into a component list with versions. That is what a pinned Gemfile.lock gives you for the release tool.

Click through it at your own pace, or open it full screen.

Where Safeguard fits

Safeguard scans dependency manifests and lockfiles, including your build tooling, to produce an SBOM and apply policy. Try a free scan.

Quick check

Is Homebrew install fine for fastlane?

The documentation lists it as an option, but Bundler gives you per-project version control and a lockfile, which is better for CI.

Should I commit Gemfile.lock?

Yes. The documentation says to add both the Gemfile and Gemfile.lock to version control.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.