Fastlane doesn't work after updating to macOS Catalina [using Fishshell] - ruby

"The file '/usr/local/bin/fastlane' specified the interpreter '/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby', which is not an executable command."

Managed to fix it by:
1.) sudo gem install fastlane -NV
After this, try running your fastlane commands. In my case they didn't work but the output did suggest to run the next commands:
2.) sudo gem install bundler:2.0.2
3.) bundle update --bundler
And now I'm running it using:
bundle exec fastlane your_lane
(instead of fastlane your_lane)

Related

Gitlab-Runner doesn't have sudo access on OSX

I have installed gitlab-runner on a new OSX device. My runner is register and launch correctly.
But when i start a job, I have this error
sudo gem install fastlane
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
What can I do avoid this error and let gitlab-runner have sudo access to execute anything ?
Most probably you granted the sudo permission to your gitlab-runner user, but you did not remove the password restriction for sudo for the gitlab-runner user. Here you can find how to do it.
However I would not recommend using sudo. You could use Bundler and then install fastlane with bundler for this project and not globally.
gem install bundler -> you will get a Gemfile for the current directory (root of the project)
put gem "fastlane" into the Gemfile
install it with bundle install (you can run this command with your gitlab-runner user in jobs)
For running fastlane lanes use: bundle exec fastlane <name_of_the_lane>.

"pod init" giving error "-bash: pod: command not found"

I am trying to create a Podfile for my Xcode project for Firebase compatibility, but when I try to create it within the same file that my Xcode project is stored in, using my terminal and typing "pod init", it throws the error "-bash: pod: command not found".
I am up to date on OSX as far as I'm aware, using Sierra 10.12.1, but I am unfamiliar with the use of Podfiles, so any help here would be great, thanks.
Looks like you didn't install CocoaPods.
To do that you install it through ruby gems, like this:
sudo gem install cocoapods
If you don't have admin privileges, try:
gem install cocoapods --user-install
if the 1st command doesn't work, try the 2nd command
sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
In my case, the 2nd command worked
For OS Catalina (as of December 2019)
gem install -n /usr/local/bin cocoapods
Brew install
$ brew install cocoapods
For me sudo gem install cocoapodsdid not work.
When I tried $sudo gem install -n /usr/local/bin cocoapods it threw me weird error messages. But brew install was pretty neat.
Got this error today. Was able to resolve it by making sure I had ruby in my PATH.
export PATH=/usr/bin/ruby:$PATH
Then (as suggested by answers above) run
sudo gem install cocoapods
Or
sudo gem install -n /usr/local/bin cocoapods
I ran into this problem yesterday, I reckon others in my situation will be too. So I am running a mac OS siera on a virtual machine on my windows so I can use xcode. Firstly you will need to update your version of ruby, it has been answered here: https://stackoverflow.com/a/38194139/7451779.
Once updated this just run: $ sudo gem install cocoapods
After all this $ pod init should work

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 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?
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 ~/.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!
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?)
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
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
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
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
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
Credits: This and this article helped me.
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: https://github.com/ruby/setup-ruby
In my case I have not specified the ruby version because I am using the .ruby-version file in my project.
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 ...
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.
Get the full path of the fastlane executable from the command line:
which fastlane
Add it to the shell profile, restart shell.

Ruby gems. Unable to add sources

I had this problem "https://stackoverflow.com/questions/19612185/unable-to-install-cocoapods-gem-from-rubygems-org-bad-response-backend-read-e" and as one of the solutions said I tried to remove/add rubygem sources. It was removed without problem, but when I tried to add it back it's giving me an error.
Here's my action on terminal and response:
$ gem sources --add https://rubygems.org/
Error fetching https://rubygems.org/:
server did not return a valid file (https://rubygems.org/specs.4.8.gz)
Does anyone know what is the problem?
Here is Easy Steps for installing Ruby in your system to help to install Cocoapods in your machine, I solved the same issue with being below mentioned steps.
Install command line tools using the command
xcode-select --install
Install Homebrew by
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Ruby using homebrew
brew install ruby
Check Ruby version
ruby -v
Install Ruby
gem source -a http://rubygems.org/
gem install cocoa pods
sudo gem install cocoapods
or
sudo gem install -n /usr/local/bin cocoapods
Go to below folder
cd ~/.cocoapods/repos
Run the below command
git clone https://github.com/CocoaPods/Specs.git master
Go to the directory where Podfile is present and run
pod install
Happy Coding๐Ÿ˜Š
Steps:
1. sudo gem install cocoapods
2. pod install
3. pod update
ensure that you are connected to internet. Your system is unable to find the latest version of gems, required by pods

Install Cocoapods on El Capitan. "pod: command not found" [duplicate]

I installed pod some time ago. However, it's stopped working so I'm working through this again.
However, I almost immediately run into a problem here:
pod install
-bash: pod: command not found
Any suggestions why this happened?
OK, found the problem. I upgraded Ruby some time ago and blasted away a whole load of gems. Solution:
sudo gem install cocoapods
For none-sudo use:
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
gem install cocoapods --user-install
Installing CocoaPods on OS X 10.11
These instructions were tested on all betas and the final release of El Capitan.
Custom GEM_HOME
This is the solution when you are receiving above error
$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:$HOME/Software/ruby/bin
$ pod --version
0.38.2
This Step Is Proper Working.
Pod Install
[ 1 ] Open terminal and type:
sudo gem install cocoapods
Gem will get installed in Ruby inside the System library. Or try on 10.11 Mac OSX El Capitan, type:
sudo gem install -n /usr/local/bin cocoapods
If there is an error "activesupport requires Ruby version >= 2.xx", then install the latest active support first by typing in the terminal.
sudo gem install activesupport -v 4.2.6
[ 2 ] After installation, there will be a lot of messages, read them and if no error found, it means cocoa pod installation is done. Next, you need to set up the cocoa pod master repo. Type in terminal:
pod setup
And wait it will download the master repo. The size is very big (370.0MB in Dec 2016). So it can be a while. You can track the download by opening Activity and go to the Network tab and search for git-remote-https. Alternatively, you can try adding verbose to the command like so:
pod setup --verbose
[ 3 ] Once done it will output "Setup Complete", and you can create your XCode project and save it.
[ 4 ] Then in a terminal cd to "your XCode project root directory" (where your .xcodeproj file resides) and type:
pod init
[ 5 ] Then open your project's podfile by typing in terminal:
open -a Xcode Podfile
[ 6 ] Your Podfile will get open in text mode. Initially, there will be some default commands in there. Here is where you add your project's dependencies. For example, in the podfile, type
/****** These are Third party pods names ******/
pod 'OpenSSL-Universal'
pod 'IQKeyboardManager'
pod 'FTPopOverMenu'
pod 'TYMActivityIndicatorView'
pod 'SCSkypeActivityIndicatorView'
pod 'Google/SignIn'
pod 'UPStackMenu'
(this is For example of adding library to your project).
When you are done editing the podfile, save it and close XCode.
[ 7 ] Then install pods into your project by typing in terminal:
pod install
Depending on how many libraries you added to your podfile for your project, the time to complete this varies. Once completed, there will be a message that says
"Pod installation complete! There are X dependencies from the Podfile and X total pods installed."
For macOS:
brew install --cask cocoapods
Original answer (outdated):
brew install cocoapods
brew cask install cocoapods-app
You have to restart Terminal after installing the gem. Or you can simply open a new tab Terminal to fix.
for M1mac people
first install cocoapods
brew install cocoapods
and if you are doing this for ios react-native
pod install
I had the same problem, running Mountain Lion with Ruby 2 installed and used instead of system ruby.
Previously I added PATH=/usr/local/bin:$PATH to my ~/.bash_profile as a way to make sure stuff installed by homebrew, including Ruby 2, took precedence over system-installed binaries.
Anyway, in this case I noticed that cocoapods would install their 'pod' binary not in /usr/local/bin but rather in /usr/local/Cellar/ruby/2.0.0-p247/bin/
So to my .bash_profile I added PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/bin/
and now cocoapods is working like a charm.
Uninstall all instances of cocopods by this command
$sudo gem uninstall cocoapods
sudo gem install -n /usr/local/bin cocoapods
sudo chmod +rx /usr/local/bin/
Try this:
sudo gem install cocoapods -V
and you must update gem to the newest release using this:
sudo gem update --system
if you want to enjoy the fast responce :)
try:
rbenv global system
and then
sudo gem install cocoapods
pod setup
Sudo-less installation
If you do not want to grant RubyGems admin privileges for this process, you can tell RubyGems to install into your user directory by passing either the --user-install flag to gem install or by configuring the RubyGems environment. The latter is in our opinion the best solution. To do this, create or edit the .profile file in your home directory and add or amend it to include these lines:
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
Note that if you choose to use the --user-install option, you will still have to configure your .profile file to set the PATH or use the command prepended by the full path. You can find out where a gem is installed with gem which cocoapods. E.g.
$ gem install cocoapods --user-install
$ gem which cocoapods
/Users/eloy/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods.rb
$ /Users/eloy/.gem/ruby/2.0.0/bin/pod install
Source: https://guides.cocoapods.org/using/getting-started.html
In terminal it's better to run installation of the cocoa pods with "sudo". In other case I'm getting an error: "You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory."
So the solution is:
sudo gem install cocoapods
so I also had the same problem. This is probably happening because your computer has an older version of ruby. So you need to first update your ruby. Mine worked for ruby 2.6.3 version.I got this solution from sStackOverflow,
You need to first open terminal and put this code
curl -L https://get.rvm.io | bash -s stable
Then put this command
rvm install ruby-2.6
This would install the ruby for you if it hasn' t been installed.After this just update the ruby to the new version
rvm use ruby-2.6.3
After this just make ruby 2.6.3 your default
rvm --default use 2.6.3
This would possibly fix your issue. You can now put the command
sudo gem install cocoapods
And the command
pod setup
I hope this was useful
This solution worked for me. Make sure to not miss the last command (export PATH=$PATH:$HOME/Software/ruby/bin).
See This.
install cocoapods from https://cocoapods.org/app
Commands & versions keep onchanging
so download tar and enjoy
gterzian is on the right track, however, if you later update your version of ruby then you'll also have to update your .profile to point to the new versioned ruby directory. For instance, the current version of ruby is 2.0.0-p353 so you'd have to add /usr/local/Cellar/ruby/2.0.0-p353/bin to your path instead.
A better solution is to add /usr/local/opt/ruby/bin to your PATH. /usr/local/opt/ruby is actually a symlink to the current version of ruby that homebrew automatically updates when you do an upgrade. That way you'll never need to update your PATH and always be pointing to the latest version.
it happens to me when I wrote
gem install cocoapods
instead of
sudo gem install cocoapods
if sudo command is not found also, write
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH
before sudo command
If you used homebrew to install ruby, this answer worked for me.
brew unlink ruby && brew link ruby
OSX 10.9.4
#Babul Prabhakar was right
IMPORTANT:
However,if you still get "pod: command not found" after using his solution, this command could solve your problem:
sudo chown -R $(whoami):admin /usr/local
Please remove the Ruby folder from -Your Disk->Library->Ruby
Deleting this folder and use sudo gem install cocoapods command to solve my issue.
The best solution for Big Sur is posted on Redit by _fgmx
Go into Xcode 12 preferences Click locations Select Xcode 12 for Developer tools/command line tools Install cocoapods for Xcode 12: sudo gem install cocoapods
This worked for me
sudo apt-get install ruby-dev
sudo gem install cocoapods
CocoaPods is built with Ruby and it will be installable with the default Ruby available on macOS. You can use a Ruby Version manager, however we recommend that you use the standard Ruby available on macOS unless you know what you're doing.
sudo gem install cocoapods
Resource: https://guides.cocoapods.org/using/getting-started.html
We were using an incompatible version of Ruby inside of Terminal (Mac), but once we used RVM to switch to Ruby 2.1.2, Cocoapods came back.
Install pod
sudo gem install cocoapods
Navigate inside platforms/ios
cd platforms/ios
Run pod install
I'm using OS Catalina and used the solution of Babul Prabhakar.
But when I closed the terminal, pod still was unable.
So I put the exports:
$ export GEM_HOME=$HOME/Software/ruby
$ export PATH=$PATH:$HOME/Software/ruby/bin
inside this file(put this command below inside the terminal):
nano ~/.bash_profile
Then save the file, close the terminal and open it up again and type:
pod --version
this link help me a lot
it work now for me on catalina (patched for macbook pro 2011) with xcode 12.4.
may sure that you don't have another older version on your mac, for me having an old xcode 10.x in my download folder caused me many issue, so read verbose instruction in terminal, that help me to solve my problem.

Resources