Sohail Ansari
Sohail Ansari

Reputation: 131

Flutter - CocoaPods installed but not working

I installed Flutter 2.5.3 on macOS 12.0.1 (Monterey) , I have cocoapods-1.11.2 installed with ruby-3.0.2 set as default. After all these when I run flutter doctor command I get this result -

Mac-mini ~ % sudo flutter doctor
Woah! You appear to be trying to run flutter as root. We strongly recommend running the flutter tool without superuser privileges. / šŸ“Ž Doctor summary (to see all details, run flutter doctor -v): [āœ“] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale en-GB)

[!] Xcode - develop for iOS and macOS āœ— CocoaPods installed but not working. 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. To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [āœ“] Chrome - develop for the web [!] Android Studio (not installed) [āœ“] VS Code (version 1.62.0) [āœ“] VS Code (version 1.61.2) [āœ“] Connected device (1 available)

! Doctor found issues in 3 categories. ashishchauhan@Ashishs-Mac-mini ~ % sudo gem which cocoapods
/Users/ashishchauhan/.rvm/rubies/ruby-3.0.2/lib/ruby/gems/3.0.0/gems/cocoapods-1.11.2/lib/cocoapods.rb

After that when I run pod setup I get this result -

-Mac-mini ~ % pod setup
Setup completed

So the main problem is flutter doctor command showing as - CocoaPods installed but not working. 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

why this is coming? I have tried installing cocoapods with various versions of ruby.

Upvotes: 2

Views: 2522

Answers (1)

Ashonko
Ashonko

Reputation: 623

This could be due to conflict with the leftovers of different Ruby versions.

  • Navigate to Library > Ruby in your finder. All the folders you see inside, delete them.
  • Then run sudo gem install cocoapods in your terminal. It should reinstall the Ruby and Cocoapods.

When done, try flutter doctor again, and your warning should be resolved.

Upvotes: 1

Related Questions