cocoapods not installing
IosCocoaCocoapodsIos Problem Overview
What does it mean and how can I fix it:
pod install
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
from /usr/local/bin/pod:22:in `<main>'
Ios Solutions
Solution 1 - Ios
Using following commands, it worked for me.
sudo gem uninstall cocoapods
sudo gem install -n /usr/local/bin
cocoapods pod install
If you encounter this error on step 2
:
> ERROR: While executing gem ... (Gem::CommandLineError) Please specify at least one gem name (e.g. gem build GEMNAME)
Then try this as step 2 instead (step 3 is not needed):
gem install -n /usr/local/bin cocoapods
Solution 2 - Ios
If you install cocoapod using brew like me
-
Reinstall cocoapods:
brew reinstall cocoapods
If you see this error message after you reinstall cocoapods by brew reinstall
go to step 2.
>
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
rm '/usr/local/bin/pod'
To force the link and overwrite all conflicting files:
brew link --overwrite cocoapods
To list all files that would be deleted:
brew link --overwrite --dry-run cocoapods
Possible conflicting files are:
/usr/local/bin/pod
/usr/local/bin/xcodeproj
2. To solve conflicting files:
brew link --overwrite cocoapods
> Linking /usr/local/Cellar/cocoapods/1.3.1... 2 symlinks created
Solution 3 - Ios
Uninstall the existing cocoapods
, if any, by following command:
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
Then install it to /usr/local/bin
instead of /usr/bin
using following command:
sudo gem install -n /usr/local/bin cocoapods
For further query, check this link to uninstall and this link to install cocoapods.
Solution 4 - Ios
In my case nothing helped, then I:
sudo gem uninstall cocoapods
cd /Users/nikkov/.rvm/rubies/ruby-2.4.1/lib/ruby
; In Finder I searched forcocoapods
and removed everything.brew install cocoapods
brew link --overwrite cocoapods
(if needed)
Solution 5 - Ios
I had upgraded my ruby version 2.5.3 to 2.7.2. Then, I want to update cocoapods from 1.9.3 to 1.10.0 . I got the following error while executing pod install
.
> can't find gem cocoapods (>= 0.a) with executable pod > (Gem::GemNotFoundException)
There is two way to install cocoapods by using homebrew & gem. If you had install cocoapods using gem run following.
sudo gem uninstall cocoapods
sudo gem uninstall -n /usr/local/bin cocoapods
If you had used brew please using the following to uninstall
brew uninstall cocoapods
If you forgot which one you used earlier, please execute both commands. Please make sure all cocoapods instances are removed to check run pod --version
.
If you find -bash: pod: command not found
as output, all instances are removed properly. Else, you may need to remove cocoapods related files manually from this directory ~/.rvm/rubies/ruby-2.5.3/lib/ruby.
sudo gem update --system
gem install cocoapods
CREDIT: https://blog.csdn.net/develop_csdn/article/details/105053383
Solution 6 - Ios
Try sudo gem update
- After remove cocoapods
- -Install cocoapods
Solution 7 - Ios
In my case the reason of the issue was Gemfile
file inside the folder with the project. When I removed this file, cocoapods started functioning as usual.
Solution 8 - Ios
When I tried @Aamir's solution, I ran into the error:
> ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: > Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/specs.4.8.gz)
This worked for my Mac:
sudo gem uninstall cocoapods
sudo gem install cocoapods
Solution 9 - Ios
Thankfully i found solution after a hours.
As you now, newest Mac Operation System(Big Sur or oldest one) use ruby as a version system. So this ruby is private. You can not write/update some files that belong ruby.
So, we had a change to install rbenv for as a version control.
Firstly you should install rbenv via brew if you don't have
$ brew install rbenv
You need to know rbenv version number. You can see with below code snipped
$ rbenv version
Install Xcode's command line tools
xcode-select --install
Install rbenv via Homebrew
brew update
brew install rbenv ruby-build
Configure rbenv
eval "$(rbenv init -)"
Install and configure Ruby
rbenv install 3.1.1
rbenv global 3.1.1
rbenv rehash
source ~/.bash_profile
Install Cocoapods:
gem install cocoapods
Solution 10 - Ios
Running these commands worked for me:
brew update
brew install fastlane
fastlane install_plugins
Solution 11 - Ios
This helped me after I tried all these ways
xcode-select --install
Solution 12 - Ios
In my case I was not able to install pod and cocoapods using gem, after changing command line tools I was able to run the commands
Solution 13 - Ios
If anyone stumbles upon this as a result of updating to react native 0.67.2+ from an older version (we were on 0.66.0) you have to make sure you re-install cocoapods via gem install cocoapods
. Otherwise, your pod install
will not work.
Solution 14 - Ios
To relink, run:
brew unlink cocoapods && brew link cocoapods
Solution 15 - Ios
I'd installed Cocoapods using gem, so I reinstalled it again using gem. nothing happened. so I removed it and install it using brew. it works.