Why is Flutter only running as Superuser?
Solution 1
I tried changing the location of flutter as answered by Günter Zöchbauer. But, flutter still needed superuser privileges. So, I gave them directly like this
sudo chown -R $USER /Users/yourUser/flutter/
This worked fine for me. Basically, giving permissions to the user for the specific folder.
Solution 2
Flutter maintains several files in it's installation directory like Dart snapshot files, this is why /Applications
, which has by default write permissions only for the root user, is not a good place to install Flutter to.
/Users/yourUser/flutter
would work fine without root privileges.
Vikram
Updated on December 05, 2022Comments
-
Vikram over 1 year
I recently tried installing the Flutter framework on my Macbook Pro (Early 2015, MacOS v10.13.6). I unzipped the packages in the
/Applications
directory and created the respective path in my bash profile. However, when running theflutter doctor
command on Terminal as the default user I encounter the following error.shlock: open(/Applications/flutter/bin/cache/shlock2538): Permission denied shlock: open(/Applications/flutter/bin/cache/shlock2540): Permission denied shlock: open(/Applications/flutter/bin/cache/shlock2542): Permission denied shlock: open(/Applications/flutter/bin/cache/shlock2544): Permission denied shlock: open(/Applications/flutter/bin/cache/shlock2546): Permission denied shlock: open(/Applications/flutter/bin/cache/shlock2548): Permission denied shlock: open(/Applications/flutter/bin/cache/shlock2550): Permission denied
When I run the
flutter doctor
command using the superuser privileges (sudo
), it is able to run, and I get the following terminal output.Woah! You appear to be trying to run flutter as root. We strongly recommend running the flutter tool without superuser privileges. / 📎 Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale en) [✓] Android toolchain - develop for Android devices (Android SDK 28.0.1) [!] iOS toolchain - develop for iOS devices (Xcode 9.4.1) ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side. Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS. For more info, see https://flutter.io/platform-plugins To install: brew install cocoapods pod setup [✓] Android Studio (version 3.1) [!] Connected devices ! No devices available ! Doctor found issues in 2 categories.
I would rather prefer running Flutter as a default user rather than with superuser privileges (even since I got a warning from the framework to run as a default user).
Can anyone please help me understand how I can fix this error and start running the Flutter framework using my default user account? Thank you.
-
Sujith Royal over 4 yearsI have moved flutter to /Users/username/flutter and flutter still needs superuser privileges. Any other reason?
-
Günter Zöchbauer over 4 yearsPerhaps because the permissions were moved with it? You vould try delete snd reinstall instead of moving.
-
Evandro Pomatti about 4 yearsRan into this problem and had to go back to Flutter build 1.9 instead of 1.12 temporarily. It seems that superuser is now required when running on Mac. I will follow up with an issue on github.