The terminal cannot find the fastlane command
zsh: command not found: fastlaneShort answer
The shell finds commands only in folders listed in PATH. fastlane is missing when it was never installed, when it lives in a Bundler setup that needs bundle exec, or when it installed into a folder that PATH does not list. Run command -v fastlane and gem environment to see which one you have.
Fix it fast
1Find out which cause you have
Check whether the shell finds it, then ask RubyGems and Homebrew where they put executables. The output tells you which cause below applies.
command -v fastlane gem environment gemdir brew --prefix2Match what you see, then jump to its fix
- 1
command -v prints nothing, and neither brew list nor gem list shows fastlanefastlane is not installed on this Mac or user accountFix - 2
A Gemfile with gem "fastlane" sits in the project, and fastlane is not installed system-wideThe project uses Bundler, so the command exists only through bundle execFix - 3
brew list shows fastlane, but command -v prints nothing, or brew itself is not foundHomebrew's folder is not on PATHFix - 4
gem list shows fastlane, but the command is not foundA gem install put the executable in a folder PATH does not listFix
- 1
What does the error look like?
zsh: command not found: fastlanefastlane: command not found
Cause 1 of 4
fastlane is not installed on this Mac or user account
1Check
Look for the tool in both package managers.
brew list --formula | grep fastlane
gem list fastlane2Fix
Install the Xcode command line tools, then install fastlane with Homebrew, which brings a suitable Ruby. The fastlane docs list Bundler as the recommended route for a project.
xcode-select --install
brew install fastlane3Verify
The command resolves and prints its version.
fastlane --versionConfirmed by docs.fastlane.tools
Cause 2 of 4
The project uses Bundler, so the command exists only through bundle exec
1Check
A Gemfile means the gem is installed for the project, not put on PATH.
cat Gemfile
bundle exec fastlane --version2Fix
Install the bundle and run every lane through Bundler, as the fastlane docs describe.
gem install bundler
bundle install
bundle exec fastlane [lane]3Verify
The version prints when called through Bundler.
bundle exec fastlane --versionConfirmed by docs.fastlane.tools
Cause 3 of 4
Homebrew's folder is not on PATH
1Check
Homebrew prints setup directions after its installer finishes, and says it will not work without following them. On Apple Silicon the default prefix is /opt/homebrew.
ls /opt/homebrew/bin/fastlane
echo $PATH2Fix
Add Homebrew's environment to your shell config file, then open a new terminal window.
# ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"3Verify
A new terminal resolves the command.
command -v fastlaneConfirmed by docs.brew.sh
Cause 4 of 4
A gem install put the executable in a folder PATH does not list
1Check
RubyGems has a gem directory and an executable directory. Ask it where gems live, and compare with the folders in your PATH.
gem environment gemdir
echo $PATH2Fix
Reinstall with an executable folder that is already on PATH (the -n or --bindir option of gem install sets it), or use Homebrew or Bundler instead.
mkdir -p "$HOME/bin"
gem install fastlane --bindir "$HOME/bin"
# ~/.zshrc
export PATH="$HOME/bin:$PATH"3Verify
Open a new terminal and check the command resolves.
command -v fastlaneConfirmed by guides.rubygems.org
How do I stop it coming back?
- Pick one install route per machine, Homebrew or Bundler, and write it in the project README.
- On CI make bundle install the first build step and call lanes with bundle exec.
- Set a UTF-8 locale (LC_ALL and LANG) in the shell profile, as the fastlane setup page asks.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Mobile apps
Jenkins finds no JUnit report after an iOS test run
No test report files were found. Configuration error?
The junit step only reads JUnit XML files.
3 causes, each with a fixMobile apps
adb cannot start because something already holds its port
adb start-server failed
The adb server must bind local TCP port 5037, and every adb client talks to it there.
2 causes, each with a fixMobile apps
The phone shows as unauthorized and Android Studio will not run the app
adb devices lists the phone but Android Studio cannot deploy to it
An unauthorized phone means it has not trusted this computer's RSA key.
3 causes, each with a fixMobile apps
Android Studio cannot pair the phone over Wi-Fi
The Pair devices over Wi-Fi dialog lists no device
Wireless pairing needs the phone on Android 11 or higher and on the same Wi-Fi network as the computer, with current Platform-Tools.
4 causes, each with a fixMobile apps
adb cannot connect to its daemon or start the server
* daemon started successfully *
The adb server is a background process on your computer that listens on TCP port 5037.
2 causes, each with a fixMobile apps
adb prints 'server version doesn't match this client; killing...'
adb server version doesn't match this client; killing...
adb runs a background server, and every adb command is a client.
3 causes, each with a fix