$HOME/.zshrc permission denied

9,146

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.

Share:
9,146
Roy
Author by

Roy

Avid mobile app developer. Currently learning the ropes of Dartlang, Flutter + Firebase/Firestore

Updated on December 26, 2022

Comments

  • Roy
    Roy over 1 year

    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

    • chepner
      chepner over 3 years
      .zshrc has already been sourced when the interactive shell starts. Sourcing it again immediately makes no sense.
    • chepner
      chepner over 3 years
      The link you provide says to edit .zshrc, not run it.
    • Roy
      Roy over 3 years
      @chepner i think the path i have set was wrong, may i ask how to edit that path again?