Repository navigation
Description
Steps to reproduce
- Configure a flutter project to run on MacOS (darwin) device
- 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 TMPDIRin ~/.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
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
tirth-patel-nc commentedon Aug 8, 2025
@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?
I understand you're targeting macOS, could you confirm if your Xcode setup is configured correctly?
seanqn commentedon Aug 9, 2025
@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-hotflag, but no have had no luck since. This occurs when VSCode itself is launched from either GUI or terminal.xcode displays that the macOS simulator is built-in but there are no results of runtimes using the
xcrun simctl listcommand. 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.
tirth-patel-nc commentedon Aug 11, 2025
keeping this open based on the report for the team’s input, thanks
5 remaining items
dubiao commentedon Aug 19, 2025
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:
I can run my project with in terminal (I mean not in vscode laucher or run and deubg button):
but this lost hot-reload feature in debug state. (I have to terminate it and rerun after edit a single line)
asedilloglatt commentedon Aug 22, 2025
I had this problem as well, but the update to macos 13.7.8 seems at first glance to have remedied it.
dubiao commentedon Aug 22, 2025
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.
asedilloglatt commentedon Aug 26, 2025
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
Workaround that works for me every time:
Workarounds that do not work for me:
See my more recent comment for more detail.
NeroSong commentedon Sep 4, 2025
I ran into the same issue and wanted to share my findings.
Environment:
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:
Solution that worked for me:
Manually deleted the affected container directory at
~/Library/Containers/com.xxx.yyyusing Finder.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!
martinmc666 commentedon Sep 6, 2025
asedilloglatt commentedon Sep 11, 2025
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:
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
martinmc666 commentedon Sep 12, 2025
well i rebooted and all seems well now
ElRochito commentedon Nov 6, 2025
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
DanTup commentedon Nov 7, 2025
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
/tmpin_createDevFS.ElRochito commentedon Nov 7, 2025
In addition, I can wrote on /tmp on my terminal :
touch /tmp/testworks fine but flutter can'tElRochito commentedon Nov 7, 2025
I try into
main.dartgot this error :
I run
flutter run -d macoswith user elrochito yet so normally I have rights permissionspedia commentedon Nov 27, 2025
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 macosfail and block my normal dev routine.Even
flutter attachfails too. the debug app crashed with outputPlease change this issue to
P0