Skip to content

DevFS restricted access to /tmp on MacOS Ventura 13.7.7 #173450

Open

Description

@seanqn

Steps to reproduce

  1. Configure a flutter project to run on MacOS (darwin) device
  2. Run the app in debug mode from VSCode or MacOS terminal [Ventura 13.7.7]

Expected results

The application simulator for the MacOS device should launch and become functional when the project is ran from VSCode GUI or using the flutter run command in the terminal.

Actual results

The application simulator for the MacOS device builds the application but appears as a blank black screen when launching from the VSCode GUI (Debug console, Run in the Menu Bar, Run Icon, etc.). When launching the application simulator from the terminal (i.e. flutter run, flutter run -d macos), the application is built and may be functional and navigable, but the process crashes after connecting to the VM service. The debug toolbar is missing hot reload and hot restart icons. In both cases, a 'PathAccessException' prevents _createDevFS from creating a temporary directory in '/tmp'. As a result, this error asynchronously suspends various other DevFS and VMService tools.

The only fix that has enabled a fully functional MacOS simulator runtime is to run flutter run --no-hot -d macos or without the device specification if it has already been defined.

Failed Workarounds:

  • Set a 'TMPDIR' environment variable in 'launch.json' to reflect a path that is in the users directory does not appear to be respected
  • Set a global export TMPDIR in ~/.zshrc
  • Launched VSCode directly from terminal to force inheritance of the TMPDIR variable
  • Granted Full Disk Access to VSCode, Terminal app, and the Flutter binary itself
  • Removed extended attributes from /private/tmp
  • Resolved dependencies

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // TRY THIS: Try changing the color here to a specific color (to
        // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
        // change color while the other colors stay the same.
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Column(
          // Column is also a layout widget. It takes a list of children and
          // arranges them vertically. By default, it sizes itself to fit its
          // children horizontally, and tries to be as tall as its parent.
          //
          // Column has various properties to control how it sizes itself and
          // how it positions its children. Here we use mainAxisAlignment to
          // center the children vertically; the main axis here is the vertical
          // axis because Columns are vertical (the cross axis would be
          // horizontal).
          //
          // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
          // action in the IDE, or press "p" in the console), to see the
          // wireframe for each widget.
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('You have pushed the button this many times:'),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs

Command

flutter run -d macos -v

Full Output

flutter_devfs_log.txt

Crash Report (Error Section of Full Log)

RPCError: _createDevFS: (-32603) Internal error
_createDevFS: Unexpected exception:PathAccessException: Creation of temporary directory failed, path = '/tmp' (OS Error: Operation not permitted, errno = 1)
#0      _checkForErrorResponse (dart:io/common.dart:58:9)
#1      _Directory.createTemp.<anonymous closure> (dart:io/directory_impl.dart:173:7)
<asynchronous suspension>
#2      createTempDirCallback (dart:vmservice_io:121:16)
<asynchronous suspension>
#3      DevFS._createDevFS (dart:_vmservice/devfs.dart:197:21)
<asynchronous suspension>
#4      VMService._routeRequestImpl (dart:_vmservice:842:16)
<asynchronous suspension>
#5      VMService.routeRequest (dart:_vmservice:805:22)
<asynchronous suspension>
#6      WebSocketClient.post (dart:vmservice_io/vmservice_server.dart:64:3)
<asynchronous suspension>
#0      new _OutstandingRequest (package:vm_service/src/vm_service.dart:265:34)
#1      VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1921:25)
#2      VmService._call (package:vm_service/src/vm_service.dart:1933:8)
#3      VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1872:14)
#4      FlutterVmService.createDevFS (package:flutter_tools/src/vmservice.dart:942:20)
#5      DevFS.create (package:flutter_tools/src/devfs.dart:518:61)
#6      FlutterDevice.setupDevFS (package:flutter_tools/src/resident_runner.dart:369:19)
#7      HotRunner._initDevFS (package:flutter_tools/src/run_hot.dart:488:23)
#8      HotRunner._attach (package:flutter_tools/src/run_hot.dart:290:41)
<asynchronous suspension>
#9      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:861:27)
<asynchronous suspension>
#10     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1563:27)
<asynchronous suspension>
#11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#12     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#13     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:494:9)
<asynchronous suspension>
#14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#15     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:431:5)
<asynchronous suspension>
#16     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:98:11)
<asynchronous suspension>
#17     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#18     main (package:flutter_tools/executable.dart:102:3)
<asynchronous suspension>

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.8, on macOS 13.7.7 22H722 darwin-x64, locale en-US) [1,448ms]
    • Flutter version 3.32.8 on channel stable at /Users/user/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision edada7c56e (2 weeks ago), 2025-07-25 14:08:03 +0000
    • Engine revision ef0cd00091
    • Dart version 3.8.1
    • DevTools version 2.45.1

[✗] Android toolchain - develop for Android devices [1,139ms]
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[!] Xcode - develop for iOS and macOS (Xcode 15.2) [6.5s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [51ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed) [49ms]
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).

[✓] VS Code (version 1.103.0) [48ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.116.0

[✓] Connected device (2 available) [10.3s]
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.7.7 22H722 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 139.0.7258.66

[✓] Network resources [1,328ms]
    • All expected network resources are available.

! Doctor found issues in 3 categories.

Activity

  1. added
    in triage
    on Aug 8, 2025
  2. tirth-patel-nc commented on Aug 8, 2025

    @tirth-patel-nc
    Member

    @seanqn thanks for the report. This seems similar to #148115. Please check the comment there to see if it helps in your case. Does it also occur with the counter app or on the master channel?

    Unable to get list of installed Simulator runtimes.

    I understand you're targeting macOS, could you confirm if your Xcode setup is configured correctly?

  3. added
    waiting for response
    on Aug 8, 2025
  4. seanqn commented on Aug 9, 2025

    @seanqn
    Author

    @seanqn thanks for the report. This seems similar to #148115. Please check the comment there to see if it helps in your case. Does it also occur with the counter app or on the master channel?

    @tirth-patel-nc it appears the counter app shows the same errors and displays only a black screen when launching from GUI (debug console, toolbar, or run icon). When ran from the terminal, the counter app has full functionality and hot reload/restart are enabled. Since encountering this issue, I have been able to get my original project to run once from the terminal without using the --no-hot flag, but no have had no luck since. This occurs when VSCode itself is launched from either GUI or terminal.

    I understand you're targeting macOS, could you confirm if your Xcode setup is configured correctly?

    xcode displays that the macOS simulator is built-in but there are no results of runtimes using the xcrun simctl list command. I will update the issue with any discoveries.

    As a note, this issue began after updating to Ventura 13.7.7. It seems like it is possible that the stricter sandbox security from this update could have impacted simulators from accessing some directories as well as DevFS.

  5. removed
    waiting for response
    on Aug 9, 2025
  6. tirth-patel-nc commented on Aug 11, 2025

    @tirth-patel-nc
    Member

    keeping this open based on the report for the team’s input, thanks

  7. added
    platform-ios
    platform-macos
    team-ios
    e: OS-version specific
    c: crash
    tool
    fyi-tool
    and removed
    in triage
    on Aug 11, 2025
  8. 5 remaining items

  9. dubiao commented on Aug 19, 2025

    @dubiao

    I also have same problem on flutter 3.32.5 and macos 13.7.7

    It's not the code problem, because just use sample project also happens. (not always).

    For your information, I have following dependencies:

    • clipboard_watcher: ^0.3.0
    • window_manager_plus: ^1.0.5
    • hive: ^2.2.3
    • hive_flutter: ^1.1.0
    • tray_manager: ^0.5.0
    • logger: ^1.1.0

    I can run my project with in terminal (I mean not in vscode laucher or run and deubg button):

    flutter run -d macos
    

    but this lost hot-reload feature in debug state. (I have to terminate it and rerun after edit a single line)

  10. asedilloglatt commented on Aug 22, 2025

    @asedilloglatt

    I had this problem as well, but the update to macos 13.7.8 seems at first glance to have remedied it.

  11. dubiao commented on Aug 22, 2025

    @dubiao

    I had this problem as well, but the update to macos 13.7.8 seems at first glance to have remedied it.

    You are lucky. But I am running on an old Macbook Pro 13 , which its newest version stoped at 13.7.7 .

    Unbelievable!! Apple has released a 13.7.8 on Aug-20? I will give it a try, but I'm not optimistic about the result.

  12. asedilloglatt commented on Aug 26, 2025

    @asedilloglatt

    Update: macos 13.7.8 update did not remedy it.
    Update: Flutter 3.35.3 update did not remedy it.

    I am running MacOS 13.7.8 on a 2017 iMac. There is nothing special about my flutter app that I know of, I have this problem with the creation of tmp directory and I am building and running my app as a MacOS app exclusively at the moment. I am on flutter 3.35.3 (updated on 9/10/2025 from 3.32.8 which also had it). I have been in this environment since February of 2025, with the exception of the MacOS minor version and the flutter version. The problem started on MacOS 13.7.7, and then continues in 13.7.8.

    Current state of things for me:

    NOTE: If you have not updated to 13.7.7, don't. But if you did already, then get the 13.7.8 update because it enables a workaround.

    Permanent changes I made

    • Updated to 13.7.8. 13.7.7 it didn't work at all but 13.7.8 allows it to work only on the first debug launch per computer reboot.
    • Updated to Flutter 3.35.3 from 3.32.8 (no effect)

    Workaround that works for me every time:

    • Reboot computer. It will build and launch in debug mode once and only once. If I need to restart app, then I need to reboot computer.
    • No other workarounds identified.

    Workarounds that do not work for me:

    • Clearing /tmp (shortcut to /private/tmp), both visible files via finder and hidden via terminal. Makes no difference.
    • Enabling Full Disk Access for VSCode, Terminal, dart, flutter, my app, dart helper executables. Makes no difference.
    • Manually setting TMPDIR environment variable in command line or via launchctl. Makes no difference.

    See my more recent comment for more detail.

  13. NeroSong commented on Sep 4, 2025

    @NeroSong

    I ran into the same issue and wanted to share my findings.

    Environment:

    • Flutter: Stable 3.27.1
    • macOS : 15.x (The issue occurred on a version before 15.6.1)

    Initially, I tried updating my macOS and Flutter to the latest versions, but the issue persisted.

    After thinking it through, I realized two events that occurred right before the problem started might be related:

    • WeChat(a chat app) incorrectly warned the disk was full, although it wasn't. A simple reboot fixed.
    • I used PrettyClean to clear junk files then.

    Solution that worked for me:

    Manually deleted the affected container directory at ~/Library/Containers/com.xxx.yyy using Finder.

    When I tried deleting it via the Terminal (sudo rm -rf ...), I surprisingly received a "permission denied" error.

    Back to my project directory and ran flutter clean && flutter pub get.

    Everything about debug run just goes well.

    My conclusion is that the application's sandbox directory was somehow corrupted, though I'm not entirely sure of the exact cause.

    Hope this helps someone!

  14. martinmc666 commented on Sep 6, 2025

    @martinmc666
  15. asedilloglatt commented on Sep 11, 2025

    @asedilloglatt

    I did a deep dive into this yesterday to figure more out.

    In a nutshell, the Flutter bug is that it can't handle the "/tmp" directory on macOS 13.7.7 and 13.7.8. On my computer (13.7.8), the "/tmp" folder is actually a shortcut/symlink to /private/tmp. The directory privileges are

    lrwxr-xr-x@ 1 root wheel 11 Aug 15 22:23 /tmp -> private/tmp
    drwxrwxrwt 13 root wheel 416 Sep 11 14:03 /private/tmp

    @NeroSong 's solution didn't work for me, i tried it. Still my app debugged on it's first time.

    The first time I debug the app after rebooting the computer, that line of code is writing to my TMPDIR as defined in my shell scripts, etc. something like... /var/folders/v4/p3yw50bn3kv335z6y15vlxn40000gn/T/

    All subsequent runs, it is trying to write to /tmp instead... and there is something preventing that from working, possibly a flutter bug.

    I tried setting the TMPDIR environment variable on the command line a few different ways when doing "flutter run", but to no avail. I tried granting full disk access so it could write to /tmp. I verified permissions allowed it. I added Full Disk access for a lot of flutter and dart executables, Terminal, and VSCode to no avail. I tried setting variables using launchctrl, nothing. I didn't try csrutil to disable file system protection, but only because I have the wrong keyboard for doing the reboot sequence to boot into recovery mode. Maybe I'll do that another day.

    Here is my theory:

    1. Apple fixed a security vulnerability that previously allowed apps easier access to environment variables, so that now getting access to environment variables has an extra step in the app and Flutter isn't doing that here. My guess this was the fix by Apple for CVE-2025-43195, I could be wrong of course... it just looks the most suspicous.
    2. Perhaps this caused a problem in MacOS 13.7.7 with some app that runs at startup, so they did a "fix" for that problem which allows the first run of an app to access environment variables more easily (or maybe just TMPDIR).
    3. Flutter has a bug where it cannot write to "/tmp" dir on macOS 13.7.x soon after the part where it launches "Dart Developer Service (DDS)"

    If my theory is correct or close enough, then this could also possibly affect macOS 14.7.7 and later, and macOS 15.6 and later.

    Here is the link about the security fix: https://nvd.nist.gov/vuln/detail/cve-2025-43195

  16. martinmc666 commented on Sep 12, 2025

    @martinmc666

    well i rebooted and all seems well now

  17. ElRochito commented on Nov 6, 2025

    @ElRochito

    Hi there !

    I've got same problem, it's works once after reboot, next run failed with same error like @seanqn

    Others got same problem again ?

    UPDATED

    After many researches, it seems an Apple restriction, wrote on DevFS is possible once per reboot ...

    So either we restart the computer each time, or we run with --release or --profile not an ideal approach for developing or debugging correctly

  18. DanTup commented on Nov 7, 2025

    @DanTup
    Contributor

    This was also reported at Dart-Code/Dart-Code#5784 by @ElRochito. From his testing, it seems like the app will work fine the first time after a reboot, but subsequent runs will fail with the error above trying to access /tmp in _createDevFS.

  19. ElRochito commented on Nov 7, 2025

    @ElRochito

    In addition, I can wrote on /tmp on my terminal : touch /tmp/test works fine but flutter can't

  20. ElRochito commented on Nov 7, 2025

    @ElRochito

    I try into main.dart

    if (Platform.isMacOS) {
        final String tempDirPath = '/Users/elrochito/flutter_app_tmp';
        final Directory tempDir = Directory(tempDirPath);
        if (!tempDir.existsSync()) {
          tempDir.createSync(recursive: true);
        }
        print('Attempting to use temporary directory: $tempDirPath');
      }
    

    got this error :

    [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PathAccessException: Creation failed, path = '/Users/elrochito/flutter_app_tmp' (OS Error: Operation not permitted, errno = 1)
    #0      _Directory.createSync (dart:io/directory_impl.dart:145:7)
    #1      main (package:eden/main.dart:12:15)
    #2      _runMain.<anonymous closure> (dart:ui/hooks.dart:319:23)
    #3      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:314:19)
    #4      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)
    

    I run flutter run -d macos with user elrochito yet so normally I have rights permissions

  21. pedia commented on Nov 27, 2025

    @pedia

    on macOS 13.7.8, flutter 3.38.0-0.2.pre and 3.39.0-0.1.pre failed because of this issue

    After reboot the computer, it works only once, then failed forever.

    flutter run -d macos fail and block my normal dev routine.

    Even flutter attach fails too. the debug app crashed with output

    _createDevFS: (-32603) Internal error
    _createDevFS: Unexpected exception:PathAccessException: Creation of temporary directory failed, path = '/tmp' (OS Error: Operation not permitted, errno = 1)
    ...
    

    Please change this issue to P0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2c: crashe: OS-version specificfyi-toolplatform-macosteam-macostooltriaged-macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions