Fastlane command not found

XcodeMacosFastlane

Xcode Problem Overview


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?

Xcode Solutions


Solution 1 - Xcode

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 

Solution 2 - Xcode

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

Solution 3 - Xcode

I met this issue because of installing zsh, the below two steps solve my problem:

  1. open ~/.zshrc
  2. save 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.

3. save upon file and try fastlane init, everything is OK!

Solution 4 - Xcode

  1. In the terminal type cd ~/ to go to your home folder
  2. Type touch .bash_profile to create your new empty file
  3. Type open -e .bash_profile to open the file
  4. Enter export PATH="$HOME/.fastlane/bin:$PATH" and save
  5. Restart terminal (not sure needed?)

Solution 5 - Xcode

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

Solution 6 - Xcode

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

Solution 7 - Xcode

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

Reference

Solution 8 - Xcode

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

Solution 9 - Xcode

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

Solution 10 - Xcode

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

Solution 11 - Xcode

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

Output Should be like

Credits: This and this article helped me.

Solution 12 - Xcode

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 ...

Solution 13 - Xcode

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)

Solution 14 - Xcode

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.

Solution 15 - Xcode

Get the full path of the fastlane executable from the command line:

which fastlane

Add it to the shell profile, restart shell.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionViswanth ChadalawadaView Question on Stackoverflow
Solution 1 - Xcodebaichao zengView Answer on Stackoverflow
Solution 2 - XcodeatitpatelView Answer on Stackoverflow
Solution 3 - XcodemistdonView Answer on Stackoverflow
Solution 4 - XcodeSunkasView Answer on Stackoverflow
Solution 5 - XcodeJijo JohnView Answer on Stackoverflow
Solution 6 - Xcodesudo bangbangView Answer on Stackoverflow
Solution 7 - XcodeAlok ChandraView Answer on Stackoverflow
Solution 8 - XcodeMohamed SalehView Answer on Stackoverflow
Solution 9 - XcodeAmitView Answer on Stackoverflow
Solution 10 - XcodeEL TEGANI MOHAMED HAMAD GABIRView Answer on Stackoverflow
Solution 11 - XcodeOwaisView Answer on Stackoverflow
Solution 12 - XcodeMohamed Elmi HassanView Answer on Stackoverflow
Solution 13 - XcodeThanh VuView Answer on Stackoverflow
Solution 14 - Xcodelittlebear333View Answer on Stackoverflow
Solution 15 - XcodevalView Answer on Stackoverflow