Fix: Zsh: Permissions Denied in Mac Terminal in 4 Quick Steps

Everything you need to regain access to your file

by Ola-Hassan Bolaji
Ola-Hassan Bolaji
Ola-Hassan Bolaji
Editor
A Computer Engineering graduate, he has spent most of his life reading and writing about computers. He finds joy in simplifying complex topics into simple solutions for PC... read more
Affiliate Disclosure
  • If you are dealing with the Zsh: permissions denied error, it might be because the folder you want to access is locked.
  • You can get rid of this error message by running some SUDO commands.
  • Another effective solution is to change the ownership of the directory you want to access.
zsh permission denied
XINSTALL BY CLICKING THE DOWNLOAD FILE
A message from our partner

To fix Windows PC system issues, you will need a dedicated tool

  • Download Fortect and install it on your PC
  • Start the tool's scanning process to look for corrupt files that are the source of your problem
  • Right-click on Start Repair so the tool could start the fixing algorythm
Download from Fortect.com Fortect has been downloaded by 0 readers this month, rated 4.4 on TrustPilot

The Zsh: Permissions Denied error is one of the common issues users encounter on Mac. The error occurs when you are trying to access a locked file or run a command without sufficient permission.

Fortunately, you can eliminate the Zsh: Permissions Denied error effortlessly with the right information. In this guide, we will provide you with everything you need to fix this error once and for all.

What is the ZSH: Permissions Denied error on Mac?

Terminal is the powerful command line interface that offers users a UNIX environment to run commands and create scripts. You can use this interface to access just about any file part on Mac with the right command.

However, if you start getting the Zsh: Permissions Denied error, it means the original command you are trying to use on Terminal to open a file is wrong, or the file or folder is locked.

In some cases, this can be a good thing, as file permission helps to protect your documents from unauthorized access. Nonetheless, we will show you how to get past the error message on your device in the next section of this guide.

How do I fix ZSH: Permissions Denied in Terminal Mac?

1. Checking file permissions

  1. Launch Terminal through Utilities or the Mac Dock.
    terminal zsh permission denied
  2. Type the command below without pressing the Return key: ls -lis 1
  3. Add a space after the command.
  4. Now, go to Finder and navigate to the file whose permission you want to check.
  5. Next, drag and drop the file in the Terminal window and press the Enter key.
  6. Wait for the command to finish running and check the result.
  7. Finally, if there is RWXR beside your username, it means you have the required permission.

The first thing to do if you are dealing with the ZSH: Permissions Denied error is to check if you have the appropriate permissions to make changes to the file you are working on.

If you have full control, you will find RWXR next to your username.

2. Allow Terminal full disk access

  1. Click the Apple logo on your home screen and select System Preferences.
  2. Now, select the Security & Privacy option.
    security
  3. Click the Privacy tab at the top.
  4. Next, click the Lock icon in the bottom left corner.
    lock zsh permission denied
  5. Enter your admin password and click the Unlock button.
    unlock
  6. Finally, mark the box next to the Terminal option to grant full disk permission.
    full terminal permission denied

If you are getting the Zsh: Permissions Denied error while trying to access a file from Terminal, it might be because Terminal does not have full disk permissions.

The solution to this is to grant it full access to your disk after typing your user password.

3. Change the directory ownership

  1. Launch Terminal and type the command (change <username> to your account username and <directorypath> to the path of the directory ) below: -R <username>:<username> <directorypath>
  2. Press the Return key.
  3. Finally, wait for the command to finish running and try to make the change again.

Sometimes, this permission error can be due to a lack of directory ownership for a user account. Following the steps above should help you change ownership easily.

4. Using SUDO commands

  1. Launch Terminal, type the following commands, and hit Return after each: sudo chmod 755 ~/Themes/ObsidianCode.xccolorthemesudo sudo chmod 755 /dvtcolorconvert.rb 
  2. If you are using the command for the first time, you will need to provide your user account password.
  3. Finally, wait for the command to finish running.

The SUDO command, which is also known as Super User do, grants your super privilege to access your account and other user accounts. So, if the Zsh Permissions Denied error is due to a privilege issue, this command help you fix it.

How do I open permission denied on Mac?

To open a file or folder giving the permission denied error on Mac, you need to change the ownership directory, as shown above.

Another option is to change file permissions using Finder, as shown below:

  1. Right-click the folder or file giving the error and choose Get Info.
    get info
  2. Click the arrow next to the Sharing & permission option to open its drop-down menu. 
  3. Now, select the user you want to grant permission in the Name column. 
  4. Finally, select Read & Write in the menu that pops up.
    read and

With this, the permission denied error should be fixed for good.

Why is my Zshrc file locked?

Your Zshrc file might be locked because you used chmod to lock it. This helps to provide protection against unauthorized access, which is why you might get the permission denied error while trying to open the file.

The Zsh: Permissions Denied error on Mac is basically down to the lack of permission to open the folder or file giving the error.

This can be easily fixed by giving Terminal full access to your disk and changing the directory’s ownership, among other solutions in this guide.

Provided you follow the steps above carefully, the error message should be gone for good. Lastly, if you want to know how to unzip files or folders using Terminal, check our detailed guide to do it easily.

This article covers:Topics: