Fix: Zsh: Permissions Denied in Mac Terminal in 4 Quick Steps
Everything you need to regain access to your file
5 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Key notes
- 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.
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
- Launch Terminal through Utilities or the Mac Dock.
- Type the command below without pressing the Return key:
ls -l
- Add a space after the command.
- Now, go to Finder and navigate to the file whose permission you want to check.
- Next, drag and drop the file in the Terminal window and press the Enter key.
- Wait for the command to finish running and check the result.
- 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
- Click the Apple logo on your home screen and select System Preferences.
- Now, select the Security & Privacy option.
- Click the Privacy tab at the top.
- Next, click the Lock icon in the bottom left corner.
- Enter your admin password and click the Unlock button.
- Finally, mark the box next to the Terminal option to grant full disk permission.
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
- 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>
- Press the Return key.
- 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
- Launch Terminal, type the following commands, and hit Return after each:
sudo chmod 755 ~/Themes/ObsidianCode.xccolortheme
sudo chmod 755 /dvtcolorconvert.rb
- If you are using the command for the first time, you will need to provide your user account password.
- 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:
- Right-click the folder or file giving the error and choose Get Info.
- Click the arrow next to the Sharing & permission option to open its drop-down menu.
- Now, select the user you want to grant permission in the Name column.
- Finally, select Read & Write in the menu that pops up.
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.
User forum
0 messages