Reputation: 2150
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Warning: CocoaPods is installed but broken. Skipping pod install.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
To re-install:
sudo gem install cocoapods
CocoaPods not installed or not in valid state.
Error launching application on iPhone 11 Pro Max.
Upvotes: 205
Views: 285324
Reputation: 173
ios
folder in xcode.It fixed the issue for me
Upvotes: 0
Reputation: 812
As the error message suggests, this is likely due to a mismatch between the version of Ruby that CocoaPods was installed with and the version being used to invoke it.
This error commonly occurs when you run flutter run
from your root directory. To resolve it, ensure that the Ruby version in the root directory matches the one in the ./ios
directory. You can cd
into each directory and run gem which cocoapods
to verify that both point to the same Ruby installation. In my case, I use rbenv to manage my ruby version, and sometimes I mix up the versions.
. <- same ruby version
├── assets
├── ios <- same ruby version
├── android
├── lib
└── test
Upvotes: 0
Reputation: 4809
Faced same problem on
Solution which worked for me
sudo gem uninstall cocoapods && sudo gem install cocoapods
However Android studio was still not able to perform the pod install as part of app deployment on iOS Simulator.
So, the trick was to perform Invalidate Cache and Restart
File -> Invalidates Cache -> Invalidate and Restart
Upvotes: 0
Reputation: 7634
The following worked in my case:
brew install cocoapods --build-from-source
then:
brew link --overwrite cocoapods
More information about this issue can be found at: https://github.com/CocoaPods/CocoaPods/issues/8955
Upvotes: 22
Reputation: 2386
I got this error when I renamed my folder name that has space.
For example, from folder\flutter_project
to new folder\flutter_project
.
It sounds silly but I spent few hours scratching my head what's the cause. Don't do the mistake that I did!
Upvotes: 0
Reputation: 67
If none of above answers can fix your case, and if you are received this warning when running flutter:
We strongly recommend running the flutter tool without superuser privileges.
try to fix this warning and it might fix the previous problem aswell.
Give Flutter the proper privileges:
sudo chown -R $USER /Users/YOUR_USER/flutter/
example: sudo chown -R $USER /Users/nguyendc/flutter/
Then, give your project the proper privileges:
sudo chown -R YOUR_USER /LINK_TO_YOUR_PROJECT
example: sudo chown -R nguyendc /Users/projects/flutter-app
Hope this helps someone who is as frustrated as I am.
Upvotes: 1
Reputation: 541
For whom suffered for hours and none of the solution worked,
if you can run pod --version
with issue, try
sudo gem uninstall activesupport
sudo gem install activesupport -v 7.0.8
then pod --version
.
If that works, try flutter doctor
. My XCode cocoapods issue is resolved after install different of activesupport.
Upvotes: 1
Reputation: 71
Same issue and fixed with the next steps:
Upvotes: 4
Reputation: 31801
If you have homebrew, and you followed the docs and ran sudo gem install cocoapods
then
sudo gem uninstall cocoapods && brew install cocoapods
brew install cocoapods
pulls brewed ruby
as a dependency, so if you don't already have the brewed ruby it will be automatically installed.
❗️During the ruby installation watch closely the log — it will display the extra path you need to add to your ~/.zshrc
or ~/.bashrc
for example /opt/homebrew/opt/ruby/bin:$PATH
(the correct path will depend on the type of mac you are using).
Upvotes: 2
Reputation: 576
Flutter framework
just restart IDE like android studio with invalidate cash worked with me
Upvotes: 0
Reputation: 152
I run first
sudo gem install cocoapods
or
$ 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
but don't work, because command tools of Xcode was not installed. you should run
xcode-select --install
to install command tools of Xcode and then use brew or rvm , ... to install cocoapods.
commands for installing brew:
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/edvard/.zprofile
finally you can install cocoapods :
brew install cocoapods
pod install
Upvotes: 0
Reputation: 29
To solve this problem you need to install cocoapods
using the --user-install
flag.
Step 1: add this to your environment path. export
PATH=~/.gem/ruby/3.2.0/bin:$PATH (remember to change your ruby version)
Step 2: install cocoapods
gem install cocoapods --user-install
Source: https://guides.cocoapods.org/using/getting-started.html#installation
Upvotes: 2
Reputation: 2187
My problem was, that when I was download the new gems, I had a network outage and one of the .podspec files was not downloaded correctly. In the middle of the json, it simply just stopped and was therefore an invalid token.
Once I found the correct podspec file, I simply had to delete it and run gem install cocoapods again.
If you don't want to search the stecific file, you could also simply just go to the .cocoapods folder, delete all pods and install it again.
This fixed it for me.
Upvotes: 0
Reputation: 77
My Issue solve and working my project Select gem to uninstall All cocoapods one by one package:
sudo gem install cocoapods, sudo gem install rails
Upvotes: -1
Reputation: 533
I had the same issue. Following worked for me
flutter run
Upvotes: 49
Reputation: 8138
This can happen if you switched from bash to zsh (or the other way around)
Check your global paths. Run echo $PATH
to list them and look for /opt/homebrew/bin
.
If missing you need to add it to .zshrc
file or .bash_profile
(whichever you are using now)
Upvotes: 1
Reputation: 2353
just change your cocoa pods version to 1.10.2 to solve your problem.
first, uninstall your current version (whatever it is)
In my case, i downgraded from version 1.11.3
$ sudo gem uninstall cocoapods
Then install the stable version (as of Nov 11, 2021)
$ sudo gem install cocoapods:1.10.2
This solved my problem.
Upvotes: 0
Reputation: 5712
I had same issue after updating my MAC OS to Monterey 12.6.5, So issue is with Ruby version, Please update the ruby to 3.1.3 , set it default. then run the cocoa pod install commands . So follow below steps :
Move to Ruby 3.1.3
and run your workspace
Dont install ruby 3.2.0 with Xcode 14.
Upvotes: 0
Reputation: 605
first check the ruby version ( command: ruby -v ) it should be the default version of macOS in my case it is ruby 2.6.10.
if you ruby version is not as the default then switch to the default version by command: rvm install "2.6.10"
then run flutter clean
after this you need to install cocapods by command: sudo gem install cocapods
finally command: flutter run and choose iOS simulator.
Upvotes: 0
Reputation: 45
On my mac after i installed a new ruby version (with RVM) seperately:
remove the ruby which was installed with RVM:
rvm list rubies
if it return:
ruby-3.0.2
enter:
rvm remove ruby-3.0.2
to remove the ruby version
then go to your flutter folder and in the terminal enter:
pod deintegrate
sudo gem uninstall cocoapods
sudo gem uninstall cocoapods-core
sudo gem uninstall cocoapods-downloader
rm -rf ~/Library/Caches/CocoaPods
rm -rf ios/Pods
pod deintegrate
curl -L https://get.rvm.io | bash -s stable
rvm install ruby --latest
In my case the latest was 3.0.0
rvm use ruby-3.0.0
rvm --default use 3.0.0
sudo gem install cocoapods
flutter clean
That fixed it for me!
Upvotes: 2
Reputation: 781
Try doing this,
sudo gem install -n /usr/local/bin cocoapods
And check,
flutter doctor
Upvotes: 5
Reputation: 116
open /Applications/Android\ Studio.app hope this helps you
Upvotes: 0
Reputation: 125
I had the same issue. Just update Android studio on VMware MacOS worked for me
Upvotes: -1
Reputation: 441
I have encountered this every time I switch the branch of the Flutter project. I had to restart my VS Code (not just reload the window) completely - quit and open again for the Cocoapods error to be gone.
Here are the steps I used and worked:
flutter clean
and flutter pub get
cd ios
and run pod install
Upvotes: 2
Reputation: 8083
In my case, I uninstalled both cocoapods and fastalane, then reinstalled them.
Upvotes: 0
Reputation: 32529
If you use bundle exec fastlane beta
command, make sure you've added gem "cocoapods"
to your Gemfile:
source "https://rubygems.org"
gem "cocoapods"
gem "fastlane"
Then execute:
bundle install
bundle exec fastlane beta
Upvotes: 3
Reputation: 370
I have tried everything but in my case the real problem was that because I had 2 additional versions of ruby installed and was switching between them with chruby
however, cocoapods were installed with ruby 3.0.1
and had it set up in my .zshrc
so that chruby would autmatically choose the right version of ruby which somehow did not work anymore on VS Code.
What I did to solve this was edit ~/.zshrc
by replacing source /usr/local/opt/chruby/share/chruby/auto.sh
with chruby ruby-3.0.1
after source /usr/local/opt/chruby/share/chruby/chruby.sh
.
This is only for people who use chruby
!
Upvotes: 0
Reputation: 784
brew uninstall cocoapods
Apply the above command line, then restart the application Android Studio.
Upvotes: 0
Reputation: 1311
Someone I know had this issue, and another person recommended this fix.
Run this command from terminal:
open /Applications/Android\ Studio.app
The issue is that there are 3 possible resource paths where you put paths to your configs....
So what happens is that when the path to your configs is not in the ~/.profile file, it can't be accessed from the opening link from the launchpad. Whenever you open a terminal session, all 3 paths are synchronised automatically. That's the difference.
Upvotes: 121
Reputation: 1147
I had the same problem while executing fastlane command.
Turned out that I installed fastlane using brew
and cocoapods were installed with gem
. Probably this is why flutter doctor
show that everything alright, but when I tried to deploy app, fastlane failed with error above. Installing fastlane and cocoapods with: sudo gem install fastlane; sudo gem install cocoapods
and removing both from homebrew resolved problem for me.
Basically make sure that you have both tools installed with the same package manager on macOS.
Upvotes: 7