📜  Flutter 无法写入文件 mac - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:59.399000             🧑  作者: Mango

代码示例1
When you are trying to call some flutter command and have such output:

Downloading Dart SDK from Flutter engine 40441def692f444660a11e20fac37af9050245ab...
mv: rename /Library/Flutter/bin/cache/dart-sdk
to /Library/Flutter/bin/cache/dart-sdk.old: Permission denied

It means you do not have sufficient permissions or the file belongs to another user.

What to do?
1) Go to provided directory with this to the file.

cd /Library/Flutter/bin/cache/
2) Check who is the owner By listing all of the files:

ls -l
with output: enter image description here

3) Change owner of this file to you

sudo chown -R $USER dart-sdk
provide password (needed by sudo) and click Enter

4) Check again who is the owner

file owner should be set for your current user

5) Repeat your flutter command