$HOME/.zshrc permission denied

Viewed 12066

i am trying to set the path for flutter and im following the guide at https://flutter.dev/docs/get-started/install/macos#update-your-path.

However, i get this error -> zsh: permission denied: /Users/roy/.zshrc

Does anybody have any solution to this?

Additionally, i have set Terminal Full Disk Access permission in Security & Privacy

enter image description here

1 Answers

You are trying to run the file .zshrc as a command. This does not make sense, as this is a special file used by setting up an interactive Z-Shell. There is nothing which forbids you to do this, but I don't see any possible reason why someone wants to do it. In any case, if you want to do it, you need to set the execute permission on the file, as you do for any other command which you want to execute, i.e.

chmod +x ~/.zshrc

But as before, you really should think first whether this is indeed something you want to do.

If you want to evaluate its content inside your current zsh process, you can do a

source ~/.zshrc

In this case, you need only read-permission, no execute-permission.

Related