1
Command PhaseScriptExecution failed with a nonzero exit code

When running the Flutter project from VS Code it works fine. When trying to run it from Xcode getting this error.

I have done everything mentioned here

As this is a Flutter project the Script is:

/Users/aby/Development/flutter/packages/flutter_tools/bin/xcode_backend.sh
Vettiyanakan
  • 7,957
  • 6
  • 37
  • 55

1 Answers1

4

I've come across the same issue, and I noticed that when running via vscode, I hit no issues. Then I tried running the app from within Xcode but in Rosetta mode (simulator running as x86, as running via vscode does). This seemed to work.

To do so, I added this to my Podfile (to make pods compile in x86 mode)

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end

  # This is to remove arm64 from the available archs:
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

You must manually do this on the EXCLUDED_ARCHS of your project as well. After that, it all worked out fine. I think that Flutter is still not running on native M1 Macs.

Rafael Costa
  • 139
  • 6