Repository navigation
Description
Summary
On macOS, flutter doctor (and therefore flutter daemon, which runs the same
workflow validators on startup) can hang indefinitely and never return if the
system's Spotlight indexer (mdworker/mds_stores) is busy or unresponsive.
This causes IDEs (VS Code / IntelliJ Dart-Code plugin) whose "Flutter Daemon"
depends on this call succeeding within a reasonable time to fail to start.
Since the underlying process never actually exits or times out, the extension
retries forever, producing an infinite start-up loop.
Root cause
AndroidStudio.allInstalled() in
packages/flutter_tools/lib/src/android/android_studio.dart calls:
final ProcessResult spotlightResult = globals.processManager.runSync(<String>[
'mdfind',
'kMDItemCFBundleIdentifier="com.google.android.studio*"',
]);This is a synchronous, blocking call with no timeout. If mdfind
doesn't return (e.g. because mds_stores/Spotlight indexing is stuck — which
can happen after macOS updates, or on large projects with heavy file churn in
build/, .dart_tool/, ios/Pods/, etc.), this call blocks the entire
flutter_tools process forever.
There is a try/catch for ProcessException right below it, but that only
guards against mdfind failing to start — not against it hanging.
Steps to reproduce
- Get the system into a state where Spotlight is unresponsive, e.g.:
mds_storespinned at high CPU doing a long re-index (observable via
Activity Monitor /ps aux | grep mds)- or simply confirm
mdfindnever returns:
timeout 8 mdfind 'kMDItemCFBundleIdentifier="com.google.android.studio*"'
exits with code 124 in this state.
- Run
flutter doctor -v, or open a Flutter/Dart project in an IDE so it
startsflutter daemon. - Observe that
flutter doctorprints only the "Flutter" section and then
hangs forever; the Flutter Daemon in the IDE never finishes starting and
the extension retries indefinitely.
Confirmed on this machine by sampling the hung flutter_tools.snapshot doctor -v process (sample <pid>): the thread is blocked in dart:io Process.start, and its only child process is:
/usr/bin/mdfind kMDItemCFBundleIdentifier="com.google.android.studio*"
Expected behavior
The Spotlight query is explicitly a "nice-to-have" per the existing comment
in the code. It should not be able to hang flutter doctor/flutter daemon
forever. The call should have a bounded timeout (a few seconds) and fall back
to the already-discovered candidate paths on timeout, the same way it already
falls back on ProcessException.
Environment
Flutter 3.44.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f94f4fc76b (2026-07-06)
Engine • revision 83675ed276
Tools • Dart 3.12.2 • DevTools 2.57.0
- macOS 26.5.2 (25F84), darwin-arm64
mdutil -s /reports "Indexing enabled."mds_storesobserved pinned near 100% CPU for an extended period during
reindexing
Suggested fix
Wrap the mdfind call with a bounded timeout (e.g. Process.start +
Future.timeout, killing the process on timeout) and treat a timeout the
same as the existing ProcessException fallback path.
Activity
mbcorona commentedon Jul 10, 2026
Thanks @dowork0711. Reproduced and root cause confirmed.
I forced
mdfindto hang deterministically by shadowing it with asleep-only shim onPATH:sample $(pgrep -f flutter_tools.snapshot)shows it blocked inProcess.starton themdfindchild, exactly as described. TherunSynccall inandroid_studio.darthas no timeout, so a stuck Spotlight takes down doctor/daemon.Routing to the tool team.
[flutter_tools] Bound Spotlight mdfind execution with timeout on macOS (
[flutter_tools] Do not always wait for the full timeout when running …
github-actions commentedon Aug 6, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.