Cocoapods error while running ios app which leads error in pod install

Issue

I am trying to create both ios and android app and It works fine for android but for ios while running flutter run it will take lot of time installing pod using pod install and at last it will give an error as shown below.

Error output from CocoaPods:
↳
         Cloning into
         '/var/folders/f6/g4njsx3x5tx5dswcbsh29tdh0000gn/T/d20210605-16785-1rc0t
         ko'...
         fatal: unable to access 'https://github.com/grpc/grpc.git/': Failed to
         connect to github.com port 443: Connection refused
Error running pod install
Error launching application on iPhone 12 Pro Max.

I tried these posts but no luck
error running pod install
error running pod install pods-runner


pubsec.yaml

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  image_picker: ^0.6.7+17
  firebase_ml_vision: ^0.9.10
  image_cropper: ^1.4.0
  firebase_core: ^0.3.4
  cloud_firestore: ^0.9.13+1
  expandable: ^5.0.1
  web_scraper:

If any extra information needed, Let me know in comments

Solution

After many research I found a solution,

Step 1: I removed all cocoapods and it’s directory using

gem list --local | grep cocoapods
sudo gem uninstall EACH_OF_THEM  // here EACH_OF_THEM means all the listed cocoapods
rm -rf ~/.cocoapods

Step 2: Installed HomeBrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 3: Install cocoapods using HomeBrew

brew install cocoapods

Step 4: remove Podfile.lock if present

cd ios
rm Podfile.lock

Step 5: Now install pod

pod install --repo-update

It will take lot of time to download and install all the dependencies.

Now, If I run flutter project using flutter run. It succeed

...
Running pod install...
Running Xcode build...
...

refered link : dev.to

Answered By – Shashank Gb

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.