DEV Community

loading...

Flutter on Linux: flutter doctor Permission denied

Heddi Nabbisen
An ICT designer/developer and a security monk with "a cool brain and a warm heart". OpenBSD/Rust etc. Interested in social issues and relationships. Founder of Scqr Inc.
・1 min read

Problem

When I tried to install Flutter on Linux, running flutter doctor was required.

Running it, however, resulted in the "permission denied" error below.

$ flutter doctor
touch: cannot touch '/opt/flutter/bin/cache/.dartignore': Permission denied
Enter fullscreen mode Exit fullscreen mode

Should I have done it as root, superuser? No. It is not recommended.

$ sudo flutter doctor
   Woah! You appear to be trying to run flutter as root.
   We strongly recommend running the flutter tool without superuser privileges.
Enter fullscreen mode Exit fullscreen mode

Solution

Invite the user to "flutterusers" group.
Here is an Arch Linux example. Run this command:

$ sudo gpasswd -a $USER flutterusers
Enter fullscreen mode Exit fullscreen mode

Log out and login again.
Then, try flutter doctor again.

$ flutter doctor
   Building flutter tool...
Enter fullscreen mode Exit fullscreen mode

Solved🙂

Optional: Another way (less recommended, perhaps)

Alternatively, it may be solved by changing /opt/flutter permission. But it is perhaps less recommended.

$ sudo chown -R <your-user>: /opt/flutter 
Enter fullscreen mode Exit fullscreen mode

Discussion (0)