Fastlane Command Not Found
I Am Trying to Install Fastlane. I Have Xcode Installed. I Installed Fastlane Using the Command Sudo Gem Install Fastlane. I Now Go into My Project Folder and...
I am trying to install fastlane. I have Xcode installed. I installed fastlane using the command sudo gem install fastlane. I now go into my project folder and type fastlane init and get the error:
-bash: fastlane: command not found.
I see that fastlane is installed and can see it here
/Users/username/.gem/ruby/2.0.0/gems/fastlane-1.70.0/bin
on my Mac.
I tried adding this to my PATH, but I still get the same error. My path is
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./Users/username/.gem/ruby/2.0.0/gems/
What am I missing here?
17 Answers
Add the following line to your bash profile:
export PATH="$HOME/.fastlane/bin:$PATH"
You can either close the terminal session and restart it or run source ~/.bash_profile to load your configuration and then you can go so you start using fastlane.
I got run into similar issue last week. I installed fastlane using homebrew on mac, but it was showing the same error.
I tried installing it using Ruby and it worked like a charm. Here is the command.
sudo gem install fastlane -NV
Also seems like you have not installed command line tools for xcode.
Install them using xcode-select --install
I met this issue because of installing zsh, the below two steps solve my problem:
open ~/.zshrcsave path
2.1 if you install fastlane with Homebrew
Copy
export PATH="$HOME/.fastlane/bin:$PATH"on the bottom line.2.2 if you install fastlane with RubyGems
Copy
export PATH="/usr/local/bin/fastlane""on the bottom line.save upon file and try
fastlane init, everything is OK!
- In the terminal type
cd ~/to go to your home folder - Type
touch .bash_profileto create your new empty file - Type
open -e .bash_profileto open the file - Enter
export PATH="$HOME/.fastlane/bin:$PATH"and save - Restart terminal (not sure needed?)
Here is what I installed on Mac - from scratch
Removed from brew install
brew uninstall fastlane
brew install rbenv
Install Ruby version 2.6.6
rbenv install 2.6.6
Set the Ruby version in global
rbenv global 2.6.6
Add Ruby to the PATH
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Install bundler
gem install bundler
Install fastlane
bundle add fastlane
fastlane is in cask now. You can install it using
brew cask install fastlane
Now you need to export PATH so that your shell can find fastlane do
export PATH="$HOME/.fastlane/bin:$PATH"
If that doesn't work, try this
export PATH="$HOME/.fastlane/bin/fastlane_lib:$PATH"
Make sure you add it to ~/.profile, ~/.zshrc or ~/.bashrc for future
brew install ruby
brew install fastlane
Warning: fastlane 2.145.0 is already installed, it's just not linked
You can use brew link fastlane to link this version.
brew link fastlane
cd iOS
fastlane init
If you are working on local machine then add following to you .bash_profile
export PATH="$HOME/.fastlane/bin:$PATH"
If you are working on Jenkins then this worked for me 😎
Under Jenkins -> Manage Jenkins -> Configure System -> Global properties -> Environment variables I added:
Name: Path Value: /bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I have got the same issue on mac 10.11, after a lot of struggling I found that the problem in installing unf_ext 0.0.7.2 gem
I have done the following from this answer
brew install coreutils
After that try reinstall fastlane again it should work again
DO NOT INSTALL FASTLANE GLOBALLY It is recommended that you use a Gemfile to define your dependency on Fastlane. This will clearly define the used Fastlane version, and its dependencies, and will also speed up using Fastlane.
Step 1: Install bundler using
sudo gem install bundler
so any time you wan run Fastlane
bundler exec fastlane ...
I faced this issue in Fedora 30 i followed these steps:-
1-installed all dev tools using these commands
sudo dnf install @development-tools
sudo dnf install @rpm-development-tools
2- run sudo gem install fastlane -NV
Fastlane worked like a charm
hope it helped
I managed to install following way
Install ruby
sudo apt install ruby ruby-dev
Add following to top of your "~/.profile" file
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Check of any errors with source ~/.profile command. If there is not output means all is good.
Install Build essentials
sudo apt-get update
sudo apt-get install build-essential
Fastlane depends on Google API Clint lets install that first
sudo gem install google-api-client
Install Fastlane
sudo gem install fastlane -NV
Check your installation
fastlane -v
Flutter and Github Actions for Android:
If you are setting up Github Actions for a Flutter project for android and run into this error in one of your steps, see the work flow below:
jobs:
release:
runs-on: ubuntu-latest
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
steps:
- uses: actions/checkout@v3
- name: Set up ruby
uses: ruby/setup-ruby@v1
- name: Setup Fastlane
working-directory: ./android # <-- Make sure you have this
run: bundle install
- name: Run Fastlane
working-directory: ./android. # <-- Make sure you have this
run: bundle exec fastlane android [lane name].
Make sure to setup the ruby/setup-ruby@v1 action correctly depending on your project. see the doc:
In my case I have not specified the ruby version because I am using the .ruby-version file in my project.
You can add fastlane path environment by add line
export PATH="$HOME/.fastlane/bin:$PATH"
to ~/.bash_profile or ~/.zsh_profile file (if you use zsh shell).
And final start new terminal session or reload using command source ~/.bash_profile or source ~/.zsh_profile (if you use zsh shell)
First,You need to check if you have the ~/.fastlane file. If you don't have the file, you can execute brew cask install fastlane command. If you already have it. Check other answers.
Im my case, I need to add this path to my env, then command is found.
export PATH="/opt/homebrew/lib/ruby/gems/3.2.0/gems/fastlane-2.214.0/bin:$PATH"
Try reinstall fastlane, it didn't create .fastlane in my $HOME dir.
RubyGems Environment:
- RUBYGEMS VERSION: 3.4.2
- RUBY VERSION: 3.2.0 (2022-12-25 patchlevel 0) [arm64-darwin21]
- INSTALLATION DIRECTORY: /opt/homebrew/lib/ruby/gems/3.2.0
- USER INSTALLATION DIRECTORY: /Users/haibozhou/.gem/ruby/3.2.0
- RUBY EXECUTABLE: /opt/homebrew/opt/ruby/bin/ruby
- GIT EXECUTABLE: /opt/homebrew/bin/git
- EXECUTABLE DIRECTORY: /opt/homebrew/lib/ruby/gems/3.2.0/bin
- SPEC CACHE DIRECTORY: /Users/haibozhou/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /opt/homebrew/Cellar/ruby/3.2.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- arm64-darwin-21
- GEM PATHS:
- /opt/homebrew/lib/ruby/gems/3.2.0
- /Users/haibozhou/.gem/ruby/3.2.0
- /opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/gems/3.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => true
- :bulk_threshold => 1000
- REMOTE SOURCES:
-
- SHELL PATH:
- /opt/homebrew/lib/ruby/gems/3.2.0/gems/fastlane-2.214.0/bin
- /Users/haibozhou/.gem/ruby/3.2.0/bin
- /opt/homebrew/opt/ruby/bin
- /opt/homebrew/opt/openjdk@11/bin
- /opt/homebrew/bin
- /opt/homebrew/sbin
Get the full path of the fastlane executable from the command line:
which fastlane
Add it to the shell profile, restart shell.