1

On a mac m2 running flutter build macos fails with the error

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

Running pod repo update does not fix the problem. I have tried rm -rf ios/Pods, flutter clear and flutter pub get but nothing seems to work. I have tried all the solutions I can find here but still the same error. This project was created on ubuntu 22.04 and I'm trying to run it on my mac mini m2. It has FlutterFire deps but I have run the update command in the cli.

markhorrocks
  • 1,199
  • 19
  • 82
  • 151

2 Answers2

0

This is how I did it:

Navigate to the /ios folder within your project. Delete the Podfile.lock file located at Your Project/ios/Podfile.lock.

Open the command prompt and execute the command pod repo remove trunk. This will remove the pod repository.

To completely remove the pod, run the appropriate command based on your Mac chip:

For Intel chip users: Run pod install --repo-update. Make sure you are in the iOS directory of your Flutter app (use cd command to navigate).

For M1 or M2 chip users which would be your case: If not already installed, run sudo arch -x86_64 gem install ffi in a regular terminal to install ffi.

Then execute arch -x86_64 pod install --repo-update.

If you encounter an error regarding the compatibility of the cloud_firestore pod, do the following:

Open the Podfile and locate the line that starts with platform :ios.

Uncomment the line and set the minimum deployment target to '12.0' (or a higher version if needed).

It should look like: platform :ios, '12.0'. Run arch -x86_64 pod install --repo-update again.

This time, the installation should work fine.

Clean the Flutter project by running flutter clean. Finally, execute flutter run to run your project.

Javad Moradi
  • 866
  • 7
  • 18
0

I solved this with

macos % sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

then

pod repo update

pod install
markhorrocks
  • 1,199
  • 19
  • 82
  • 151