问题
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?
回答1:
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 🚀
回答2:
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
回答3:
I met this issue because of installing zsh, the below two steps solve my problem:
open ~/.zshrc
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.save upon file and try
fastlane init
, everything is OK!
回答4:
- In the terminal type
cd ~/
to go to your home folder - Type
touch .bash_profile
to create your new empty file - Type
open -e .bash_profile
to open the file - Enter
export PATH="$HOME/.fastlane/bin:$PATH"
and save - Restart terminal (not sure needed?)
回答5:
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
回答6:
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
回答7:
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
回答8:
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 Fastlanebundler exec fastlane ...
回答9:
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)
回答10:
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.
回答11:
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
回答12:
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
回答13:
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
回答14:
Get the full path of the fastlane executable from the command line:
which fastlane
Add it to the shell profile, restart shell.
来源:https://stackoverflow.com/questions/36369197/fastlane-command-not-found