Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Running flutter commands fail on macOS using nix package manager. #167823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Malchior95 opened this issue Apr 25, 2025 · 7 comments
Open

Running flutter commands fail on macOS using nix package manager. #167823

Malchior95 opened this issue Apr 25, 2025 · 7 comments
Labels
a: desktop Running on desktop c: crash Stack traces logged to the console platform-mac Building on or for macOS specifically team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@Malchior95
Copy link

Steps to reproduce

Hello, I am experiencing issues running flutter run, flutter build, and flutter clean, on MacOS, using nix package manager, nix-darwin and direnv.
E.g. flutter run causes this error:

Target release_unpack_macos failed: Exception: Failed to extract arm64 x86_64 for /Users/ironche/repos/flutter/form_edit/build/macos/Build/Products/Release/FlutterMacOS.framework/Versions/A/FlutterMacOS.
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't create temporary output file: /Users/ironche/repos/flutter/form_edit/build/macos/Build/Products/Release/FlutterMacOS.framework/Versions/A/FlutterMacOS.lipo (Permission denied)

Checking details of that directory, I see that files and directories are read only.

-r-xr-xr-x  1 ironche staff 27191136 Jan  1  1970 FlutterMacOS
dr-xr-xr-x 17 ironche staff      544 Jan  1  1970 Headers
dr-xr-xr-x  3 ironche staff       96 Jan  1  1970 Modules
dr-xr-xr-x  5 ironche staff      160 Jan  1  1970 Resources
dr-xr-xr-x  3 ironche staff       96 Jan  1  1970 _CodeSignature

I am using nix package manager - so I expect some files to indeed be readonly, but that should not affect the build process. This particular dev shell flake should work - it works on another PC running NixOS.

I see that there are multiple past issues describing similar problem, and this issue should be fixed as of flutter 3.22:
#147142
#148717
Workaround presented here does not work for me
#148354 (comment)

I am using flutter 3.29.2.

Attached are full logs of flutter run, flutter run -v, and my devenv flakes (Please not that I appended .log to my nix flakes so that github would let me upload the files).

flutter_run_short.log
flutter_run.log

android.nix.log
flake.nix.log

Actual results

Error messages described above.

Logs

Logs attached as files.

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.2, on macOS 15.4.1 24E263 darwin-arm64, locale en-PL)
Could not find SDK Platform Version: 
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4)
[!] Xcode - develop for iOS and macOS (Xcode 16.3)
    ✗ Unable to find the iPhone Simulator SDK.
    ✗ CocoaPods not installed.
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      For installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 3 categories.
@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Apr 28, 2025
@darshankawar darshankawar changed the title Flutter run fails. Permission denied. Running flutter commands fail on macOS using nix package manager. Apr 28, 2025
@darshankawar
Copy link
Member

I'll keep the issue open for team's tracking / attention based on the report and considering it was fixed earlier #147142. Meantime, I'll try to install nix to recreate the reported behavior.

@darshankawar
Copy link
Member

/cc @LouiseHsu

@darshankawar darshankawar added tool Affects the "flutter" command-line tool. See also t: labels. platform-mac Building on or for macOS specifically team-tool Owned by Flutter Tool team c: crash Stack traces logged to the console a: desktop Running on desktop and removed in triage Presently being triaged by the triage team labels Apr 28, 2025
@MGlolenstine
Copy link

I have hit the exact same issue and the workaround doesn't fix it for me either.
Giving permissions to the FlutterMacOS.framework doesn't seem to persist between rebuilds.

@Yannmm
Copy link

Yannmm commented May 6, 2025

I have exact the same issue. I use Flutter 3.24.3. This seems to be irrelevant with flutter version. It happens after my Mac upgrade to 15.4

what's even more interesting, for projects that have nix env build before. Everything works fine. But for projects that does not have nix env built before. The issue above happens.

@patmuk
Copy link

patmuk commented May 7, 2025

Same for me with Flutter 3.24.4. On macOS 15.4.1.
Using a flake with direnv.
Projects that worked before are failing now

The error I get is
/Users/patmuk/code/own/sherry/examples/todo_example/fixme/ios/DerivedData/Runner/Build/Products/Debug-iphonesimulator/Flutter.framework/Flutter.lipo Permission denied

I figured that building in Xcode (Product -> Build) changes the permission of
ios/DerivedData/Runner/Build/Products/Debug-iphonesimulator/Flutter.framework (and its subfolders) to dr-xr-xr-x.

Manually chmoded to uga+rwx, started the build in Xcode and noticed the changed permissions.

But I can't find the place where the permissions are changed.

@patmuk
Copy link

patmuk commented May 7, 2025

There are some places that do chmod, for example https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/build_system/targets/ios.dart line 321.

But I did not find the one which sets Flutter.framework to u-w.

@patmuk
Copy link

patmuk commented May 7, 2025

I can confirm that it is a nix issue.
I installed the same flutter version (3.24.4.) via my old workaround (see https://github.com/patmuk/flutter-UI_rust-BE-example) - and this changing the settings as well, but to drwxr-xr-x. Something in nix must falsely set them to dr-xr-xr-x.
I noticed as well that I needed to create a new flutter project - when I tried to run the project created with the flutter version I ran into the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: desktop Running on desktop c: crash Stack traces logged to the console platform-mac Building on or for macOS specifically team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

5 participants