Flutter error: CocoaPods’s specs repository is too out-of-date

Updated: January 13, 2023 By: A Goodman 5 comments

This article is about an error you may encounter when developing a Flutter application for iOS devices.

Problem

The error often occurs when you use one or many packages related to Firebase, like cloud_firestore, firebase_analytics, firebase_auth, firebase_messaging, firebasee_storage, etc.

The error message is so long, but the last lines of it are the most informative:

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

Error running pod install
Error launching application on iPhone 14.

The error happens because your cocopods repo is out of date. If you run the update command as instructed by the error message, it will NOT work as expected:

pod repo update

Don’t panic. Below are a couple of different solutions that can help you get through the problem.

Solutions

Solution 1

This solution works in the vast majority of cases.

1. Delete the Podfile.lock file in <your-project>/ios directory if it exists (sometimes, this file can be found nowhere):

Note: “Podfile.lock” is used to make sure that every team member has the same versions of pods installed on the project. This file will be auto-generated with the “flutter run” command, so deleting it isn’t dangerous and worth worrying.

2. Also, in the ios folder, run the following command:

pod install --repo-update

This command will update the CocoaPods specs.

3. Go back to the root directory of your project, then execute this:

flutter clean

This command will clear the build cache, which is generated on application run time when a temporary file is automatically generated in the dart-tools folder, android folder, and iOS folder.

4. Finally, perform the following:

flutter run

Solution 2

This solution is a bit different from the one above.

1. At the root of your project, execute this command:

flutter clean

2. Go to the ios folder and delete the following:

  • The Pods folder
  • the Podfile.lock file (if it exists)

3. Go back to the root directory of your project and run:

flutter pub get

4. Go to your ios folder again, then run:

pod install

5. Now rebuild you and check the result:

flutter run

Final Words

We’ve solved a common error when developing an iOS application with Flutter and Firebase. You can explore more about these things by taking a look at the following articles:

You can also check out our Flutter topic page or Dart topic page for the latest tutorials and examples.

Subscribe
Notify of
guest
5 Comments
Inline Feedbacks
View all comments
Hal Gurgenci
Hal Gurgenci
1 year ago

I tried both suggestions to day and they did not work for me. The step that does not work is: pod install many lines of output (mostly names of the files) that ended with: [NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports… Read more »

victor
victor
2 years ago

dont work on mac M1

Nalo
Nalo
2 years ago

Thanks, this saved my life!

Related Articles