Hallo, I use your plugin in Linux for some years and it works well. However, if I try to use it on mac M4 with the latest macOS and the latest Android Studio, the plugin stops working with an error. Please find details below:
-
mac M4 with macOS 26.1 (25B78)
-
Android Studio Otter | 2025.2.1 Patch 1
-
dart is awailable from the command line in Android Studio terminal:
family@mac-mini-m4 ~ % which dart
/Users/family/work/android/flutter/bin/cache/dart-sdk/bin/dart
family@mac-mini-m4 ~ % dart --version
Dart SDK version: 3.7.0-323.0.dev (dev) (Mon Jan 13 04:02:13 2025 -0800) on "macos_arm64"
- dart format is installed using "dart pub global activate dart_format" as mentioned in the documentation and also awailable from the command line in Android Studio terminal:
family@mac-mini-m4 ~ % which dart_format
/Users/family/.pub-cache/bin/dart_format
family@mac-mini-m4 ~ % dart_format
dart_format v1.4.2 (c) 2022-2024 Mark Eggenstein
Usage: dart_format [args]
<dart file> [<dart file> ...] Formats the specified dart file(s)
--config=<config JSON> Specifies the configuration
--dry-run, -dr Writes output to "<original filename>.formatted.dart"
--errors-as-json Writes errors as JSON to stderr
--log-to-console Logs to console
--skip-version-check Skips version check on start-up
--web[service] Starts in web service mode
- The plugin successfully installed:
- When I start the IDE, an error appears:
family@mac-mini-m4 ~ % cat /System/Volumes/Data/private/var/folders/jm/c4x8bmfn5010qf9tcqqjkfxr0000gn/T/DartFormatPlugin_2025-12-08_22-41-27_89526.log
2025-12-08 22:41:27.262 DEBUG: OsTools()
2025-12-08 22:41:27.263 DEBUG: IsWindows: false (Mac OS X)
2025-12-08 22:41:27.263 DEBUG: TempDir: /var/folders/jm/c4x8bmfn5010qf9tcqqjkfxr0000gn/T/
2025-12-08 22:41:27.263 DEBUG: $HOME: /Users/family
2025-12-08 22:41:27.263 DEBUG: $SHELL: /bin/zsh
2025-12-08 22:41:27.277 DEBUG: Starting external dart_format: /bin/zsh -c "/Users/family/.pub-cache/bin/dart_format" --web --errors-as-json --log-to-temp-file
2025-12-08 22:41:27.294 ERROR: Error-Notification: Unexpected process exit while waiting for connection details from external dart_format.
2025-12-08 22:41:27.295 ERROR: StdErr: /Users/family/.pub-cache/bin/dart_format: line 8: dart: command not found|Did you install the dart_format package?|Basically just execute this:<pre>dart pub global activate dart_format</pre>
2025-12-08 22:42:20.182 ERROR: Error-Notification: Cannot format because external dart_format failed to start.
- When I try /bin/zsh -c "/Users/family/.pub-cache/bin/dart_format" --web --errors-as-json --log-to-temp-file from the command line in Android Studio terminal, it seems to work:
family@mac-mini-m4 ~ % /bin/zsh -c "/Users/family/.pub-cache/bin/dart_format" --web --errors-as-json --log-to-temp-file
dart_format v1.4.2 (c) 2022-2024 Mark Eggenstein
Usage: dart_format [args]
<dart file> [<dart file> ...] Formats the specified dart file(s)
--config=<config JSON> Specifies the configuration
--dry-run, -dr Writes output to "<original filename>.formatted.dart"
--errors-as-json Writes errors as JSON to stderr
--log-to-console Logs to console
--skip-version-check Skips version check on start-up
--web[service] Starts in web service mode
Do you have any idea? Please note:
- the Dart is installed with the Flutter together and it does not create any PATH variables automatically. I manually expanded my .zshrc by PATH variable as follows:
export PATH=$PATH\:$HOME/work/android/sdk/platform-tools:$HOME/work/android/flutter/bin:$HOME/work/android/flutter/bin/cache/dart-sdk/bin:$HOME/.pub-cache/bin
It means, these path variables are only accessable when $HOME/.zshrc is properly sourced. May be some mac-specific privacy issue?
- I use here a slightly older Dart SDK version 3.7.0. Is the latest plugin version compatible with it? may be I need an older plugin version?
Hallo, I use your plugin in Linux for some years and it works well. However, if I try to use it on mac M4 with the latest macOS and the latest Android Studio, the plugin stops working with an error. Please find details below:
mac M4 with macOS 26.1 (25B78)
Android Studio Otter | 2025.2.1 Patch 1
dart is awailable from the command line in Android Studio terminal:
Do you have any idea? Please note:
It means, these path variables are only accessable when $HOME/.zshrc is properly sourced. May be some mac-specific privacy issue?