Do not reinstall Fastlane on the CI node first. For Fastlane Ruby version conflict troubleshooting, compare the Ruby and Bundler paths used by the failing job, run the project’s locked dependencies through bundle exec, and verify the Xcode command-line tools in that same job environment. Change dependency declarations only when the logs show that they are the source of the mismatch.
This guide is for IT and platform engineers maintaining enterprise iOS pipelines, Fastfile and Gemfile maintainers, and technical leads validating a Mac build node. It focuses on the case where Fastlane works locally but behaves differently in Mac CI.
Start with the failure stage, not a presumed cause
A CI error mentioning Ruby or a gem does not, by itself, prove that the node needs a Ruby upgrade. First identify where the job stops:
- Before Fastlane starts: the shell cannot resolve the executable, or Ruby cannot load a required dependency.
- While loading the project: Bundler, a plugin, or a Gemfile declaration may differ from the command being invoked.
- After a lane begins: the failure may be in a lane action, signing step, or Xcode command rather than dependency loading.
- After a node change or restart: the job may be running under a different user or non-interactive shell with a different
PATH.
Keep the complete failing command and its surrounding log lines. A final error line without the command that produced it is weak evidence. Preserve the job’s shell, user, working directory, and environment context when collecting diagnostics; output from a developer’s interactive terminal may describe a different execution path.
A useful initial record is small and repeatable:
whoami
pwd
printf '%s\n' "$SHELL" "$PATH"
command -v ruby
ruby -v
command -v gem
gem env home
command -v bundle
bundle --version
command -v fastlane
fastlane --version
If a command is unavailable, record that fact rather than silently substituting another executable. The point is to learn what the CI shell actually resolves.
Compare Ruby and gem resolution across the failure scenarios
Fastlane may be installed on a machine while the project’s CI command resolves a different executable or gem set. A version string alone is not enough: record both the path and the reported version, then compare them with the project’s install and launch commands.
| Observed scenario | Evidence to capture in the job | What the evidence helps distinguish |
|---|---|---|
fastlane is not found |
PATH, command -v fastlane, install command |
Executable resolution versus a missing installation |
| Fastlane starts but cannot load a gem | Ruby and Bundler paths, gem env home, full load error |
Wrong gem location versus a dependency absent from the selected bundle |
| Local lane passes, CI lane fails | Matching commands and environment output from both contexts | Differences in shell, user, working directory, or dependency entry point |
| Failure starts after a node change | Before-and-after environment records | A changed execution context versus a project dependency change |
Do not use which fastlane from a separate login session as proof of what a CI job runs. Execute the checks in the pipeline step, or temporarily add them immediately before the failing Fastlane invocation. If the job uses a wrapper script, inspect the wrapper’s command and environment too.
For a project-managed setup, compare the plain commands with the bundle-scoped commands:
bundle check
bundle exec ruby -v
bundle exec fastlane --version
bundle exec fastlane <lane>
Replace <lane> with the lane the pipeline actually runs. Keep the original command in the logs so the comparison remains useful. The commands are diagnostic probes; they do not establish that a particular Ruby distribution or node configuration is correct for every project.
Use the lockfile to make the dependency entry point explicit
Bundler’s rationale explains how a Gemfile and lockfile define the project’s dependency set, while its workflow guide describes installing and executing that set. The lockfile helps preserve the selected dependency versions, but it cannot compensate for a CI job that bypasses the project’s bundle. See the Bundler rationale and Bundler workflow guide.
Check the files as a connected declaration, not as independent clues:
- Inspect the
Gemfilefor the declared Fastlane dependency and any plugin declarations. - Inspect
Gemfile.lockfor the resolved dependencies and platforms recorded for the project. - Check that the CI install command runs in the directory containing the intended Gemfile.
- Check that the Fastlane execution command uses
bundle execwhen the project is managed with Bundler. - Compare the Ruby selected in CI with the runtime the team uses to install and test the bundle.
- Keep the install and execution commands in the same job context, unless the pipeline explicitly transfers a verified bundle between contexts.
A practical comparison is:
| Dependency workflow | What it provides | Main risk to check |
|---|---|---|
Global gem install and plain fastlane |
A direct executable available to a shell that can resolve it | The job may load globally installed gems that differ from project expectations |
Project Gemfile and bundle exec fastlane |
A command scoped to the project’s Bundler dependency set | CI may run from the wrong directory, use a different Ruby, or skip the bundle |
| Lockfile changed during CI | Potentially updates the resolved set while the job is running | The tested dependency state may differ from the committed project state |
The third option should not be treated as routine recovery. If CI modifies or regenerates the lockfile, capture that behavior and determine why it occurs before accepting it as the team’s build process. Clearing a cache or upgrading every gem may change several variables at once and make the original discrepancy harder to identify.
Check plugin loading and Fastfile declarations together
A plugin can be present in one environment and missing in another if the project declares it in one place but invokes it through a different dependency context. Fastlane’s plugin documentation describes declaring and using plugins; compare those instructions with the project’s Gemfile, lockfile, Fastfile, and CI commands in the same checkout. See the Fastlane plugin guide.
Use this sequence when a lane reports an unavailable action or plugin:
- Confirm that the plugin is declared in the project’s expected dependency files.
- Confirm that the CI install step completed successfully in the same project directory.
- Run
bundle checkbefore the lane to see whether the current bundle satisfies the declared dependencies. - Invoke the lane with
bundle execif that is the project’s dependency workflow. - Compare the plugin-related error with the exact command and Ruby path from the same job.
- Only then decide whether the project declaration or lockfile needs a change.
Do not infer a missing plugin solely from an error label. A command can resolve a Fastlane executable while loading dependencies from an unintended context. Conversely, changing a plugin declaration will not fix a shell that resolves the wrong Ruby or bypasses Bundler.
Separate Xcode tool selection from Ruby failures
When Fastlane starts successfully and a build action fails, treat the Xcode toolchain as a separate diagnostic branch. Capture the failing build command and its complete output. Then inspect the developer directory selected in the CI job:
xcode-select -p
xcrun --find xcodebuild
Apple’s documentation explains how to install Xcode command-line tools and select the developer directory. Use the Apple command-line tools documentation to verify the relevant setup steps. These checks establish what the job can resolve; they do not prove that a project’s build settings, signing configuration, or source code are valid.
Fastlane’s CI guidance also covers CI-oriented setup, and its setup_ci action documents CI-specific setup such as creating a temporary keychain. Consult the Fastlane CI guide and setup_ci action reference when the failure involves CI setup or signing context. Do not change signing or keychain behavior to address a Ruby load error without logs connecting the two.
A quick decision score can help a team prioritize checks. It is an editorial triage aid, not a compatibility benchmark: higher scores mean the check is more directly useful for isolating the named failure.
| Check | Executable missing | Gem or plugin load error | Xcode command failure |
|---|---|---|---|
Capture PATH and resolved executable paths |
5/5 | 4/5 | 2/5 |
Compare Gemfile, lockfile, and bundle exec use |
2/5 | 5/5 | 2/5 |
Inspect xcode-select -p and the failed tool command |
1/5 | 1/5 | 5/5 |
Use the score to choose the first investigation, not to skip the others when evidence points to a second issue.
Verify environment persistence after a node change
A self-hosted Mac can behave differently after a restart, user change, or image update even when the repository has not changed. The reason must be established from the job’s evidence. Check whether the pipeline is non-interactive, which account launches it, what PATH it receives, and where the required gems were installed.
A repeatable node acceptance run should record:
- The user, working directory, shell, and
PATHat the start of the job. - The resolved Ruby, Bundler, Fastlane, and gem paths.
- The dependency install command and its exit status.
- The Fastlane command executed through the project’s chosen dependency workflow.
- The selected Xcode developer directory and the actual build command.
- Whether the same checks still produce the expected evidence after the node is restarted or replaced.
This is more useful than labelling a node “stable” after one successful run. It gives the team a before-and-after record and makes it possible to distinguish an environment change from a dependency change. Bundler’s project-scoped workflow is a way to make the dependency entry point explicit; it is not a promise that shell configuration or Xcode selection will remain unchanged.
Frequently asked questions
Why can Fastlane work locally but fail to load a gem in Mac CI?
The local terminal and the CI job may resolve different Ruby executables, gem directories, or Bundler contexts. Capture command -v ruby, ruby -v, gem env home, and the Fastlane command inside the failing job under the same user and shell. Compare those results with the project’s lockfile and install command before reinstalling anything.
Should an enterprise Fastlane job use system Ruby or project Bundler?
Use the Ruby and dependency workflow declared and tested by the project, then launch Fastlane through that bundle with bundle exec. This makes the lockfile relevant to the command being run. A system Ruby may still be part of the chosen setup, but its presence alone does not prove that the job is using the intended gems or executable.
How do I verify that the lockfile matches the Ruby CI actually runs?
Read the lockfile’s dependency and platform information, then compare it with the runtime reported inside the job. Run bundle check and the project’s Fastlane command through bundle exec in the same shell. Record the Ruby path, version output, Bundler path, and install errors. Change dependencies only when that evidence points to a declaration or lockfile mismatch.
Fastlane starts, but an Xcode tool is missing. What should I inspect?
Treat this as a separate toolchain check, not automatically as a Ruby failure. Capture the failed command and full output, inspect the selected developer directory with xcode-select -p, and verify command-line tools in the job’s own environment. If the lane reaches a build action, use that action’s error as evidence before changing Ruby or gems.
Turn the evidence into a controlled fix
Once the failing stage is known, change one cause at a time. If the command resolves the wrong executable, correct the CI invocation or environment and rerun the same diagnostic commands. If the project’s bundle is missing a declared dependency, repair the install workflow in the project directory and verify it with bundle check. If the lockfile does not represent the intended dependency set, update it deliberately, review the change, and test the resulting lane.
For a plugin failure, align the plugin declaration, bundle installation, and Fastlane invocation. For a missing Xcode tool, verify the developer directory and command-line tool selection in the CI context before touching Ruby dependencies. For failures that reappear after a node change, compare the saved environment record rather than applying a blanket cache clear.
The minimum useful recovery record includes the original error, the command that failed, the actual executable paths, the relevant Gemfile and lockfile state, the change made, and the rerun result. That gives the next maintainer a reproducible trail rather than a sequence of guesses.
Fastlane Ruby version conflict troubleshooting is therefore a question of execution context first and dependency changes second. An ad hoc shared Mac can leave teams with undocumented PATH differences, user-specific gem installs, and state that changes after a restart. A remote Mac environment can provide a separate place to validate the same project and record its actual results, but it still needs a project-specific acceptance run; no environment should be assumed compatible without testing. If the team needs a temporary or repeatable Mac CI test environment, review bookamini’s remote desktop access information and available plans, and check the privacy information against internal requirements. For sustained heavy workloads or workflows that require direct physical interfaces, purchasing and managing dedicated hardware may be the better fit.
Frequently asked questions
Why does Fastlane work locally but fail to find a gem in Mac CI?
The local terminal and CI job may resolve different Ruby executables, gem directories, or Bundler contexts. Capture `command -v ruby`, `ruby -v`, `gem env home`, and the Fastlane command from inside the failing job, under the same user and shell that runs the lane. Compare those results with the project’s lockfile and install command before reinstalling anything.
Should an enterprise Fastlane job use system Ruby or the project's Bundler setup?
Prefer the Ruby and dependency workflow declared and tested by the project, then launch Fastlane through that bundle with `bundle exec`. This makes the lockfile relevant to the command being run. A system Ruby can still be part of the chosen setup, but its presence alone does not prove the job is using the intended gems or executable.
How can I check whether Gemfile.lock matches the Ruby used in CI?
Read the lockfile’s dependency and platform information, then compare it with the runtime reported inside the job. Run `bundle check` and the project’s Fastlane command through `bundle exec` in the same shell. Record the Ruby path, version output, Bundler path, and any install errors. Change dependencies only when this evidence points to a declaration or lockfile mismatch.
Fastlane starts, but an Xcode command is missing. What should I inspect first?
Treat this as a separate toolchain check, not automatically as a Ruby failure. Capture the failing command and its full output, inspect the selected developer directory with `xcode-select -p`, and verify the command-line tools in the job’s own environment. If the lane reaches a build action, use that action’s error as evidence before changing Ruby or gems.
Further reading
Reproduce Fastlane Failures on a Dedicated Cloud Mac
Run your Fastlane workflow on a dedicated physical Mac mini from bookamini, not a shared virtual machine.
