Permission denied” Mac Terminal error | Jobs Vox


Get a “zsh: permission denied” error in the terminal when you try to open a file with the command? Here’s what you can do to fix it.

Do you keep getting “zsh: permission denied” errors on your Mac’s terminal? Several reasons—such as insufficient permissions and ownership issues—often cause this.

Below are some things you can do to fix “zsh: permission denied” error on macOS Terminal. So let’s get started.

Double check the command

It’s a good idea to start by double-checking the command that produces “zsh: permission denied” terminal output. An incorrect command, syntax, or error in the file path or file name is a common cause of the error.

If you’re new to command line interpreters, feel free to check out our beginner’s guide to Mac Terminal and our command cheat sheet for help.

Unlock a file or folder

The “zsh: permission denied” terminal error can also appear when you try to access a locked file or folder in macOS. To unlock a file or folder, control– Click on an item, select it Get informationand clear the sidebar locked.

Get info dialog for a file in macOS.

Alternatively, you can use the following command to unlock the item via Terminal:

chflags nouchg [file or folder path]

Add execution permissions

If the error “zsh: permission denied” occurs when opening an SH (shell script) file in macOS Terminal, it is likely that it does not have “execute” permissions.

To fix this, use either of the following commands to add “execute” permissions to the file:

chmod +x [SH file path]chmod +755 [SH file path]

Adding execute permissions to the SH file via the macOS terminal.

Change user and group ownership

If you get the error “zsh: permission denied”, change the user and group ownership of the file or folder with the following terminal command. Replace both copies USER with your Mac account username.

chown -R $USER:$USER [file or folder path]

ZSH permission denied error on Mac fixed

“zsh: permission denied” is not an unusual error in the macOS terminal. A mis-run command is often a prime suspect, but keep the rest of the pointers above in mind so you know what to do the next time you run into one.

Source link

Implement tags. Simulate a mobile device using Chrome Dev Tools Device Mode. Scroll page to activate.