Search code examples
iosflutterxcodedartpermission-denied

Flutter XCode Permission Denied


Whenever I run the project I get this error saying permission denied

Running pod install...
Running Xcode build...
Xcode build done.                                           37.3s
Failed to build iOS app
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/facebook_auth_desktop-0.0.9/lib/src/custom_http_client.dart:3:8: Error: 
Error when reading '../../../.pub-cache/hosted/pub.dev/http-0.13.6/lib/http.dart': Permission denied

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.```

Solution

  • It seems like that you don't have permission reading http.dart file, you can try the following methods:

    1. Modify the permissions of the .pub-cache directory to read and write. Run the following command in a terminal:
    sudo chmod -R 777 ~/.pub-cache
    
    1. Delete the .pub-cache directory, and then re-run the flutter pub get command to re-download dependencies:
    rm -rf ~/.pub-cache
    flutter pub get
    
    1. Add your Terminal or iTerm2 App to Full Access list, if you use these to run flutter app.