Search code examples
iosxcodeflutter

Flutter iOS - Run script : xcode_backend.sh Operation not permitted


I'm trying to build any Flutter app on iOS on a new Macbook pro 16" My project used to work well, then after some flutter upgrade, i can't build any project with Xcode

Problem:

/bin/sh: /Users/{MyUserName}/Documents/dev/utils/flutter/packages/flutter_tools/bin/xcode_backend.sh:

Operation not permitted Command PhaseScriptExecution failed with a nonzero exit code

What i tried:

  • Upgrading Xcode & Command line tools
  • chmod -R 755 my project, and the flutter lib
  • Follow the Flutter tutorial to use flutter with the latest version of xcode
  • Switching flutter channel (tried stable 1.17 & master 1.19)
  • Delete Xcode (& dependencies) delete Flutter & reinstall both

Now, when i try to create a new flutter project I always face the issue. The builds are working when i use flutter run from CLI (on my device) But if i try to use the project with xcode & try to build or run, i face the issue above.

I cant really find similar issues on the web.

PS: My project are working on my old macbook pro 13" same version of xcode and Flutter


Solution

  • Found the answer:

    The problem was that Xcode App didn't have enough rights to read / write files & folders.

    To solve it:

    • Go to System preferences > Security & Privacy
    • Last tab: Privacy
    • Full disk access: Add Xcode App

    If you dont want Xcode to have full disk access you can add it in "Files and folders" instead, and give Xcode rights to your projects folder