A permission error known as the Zsh Permission Denied Error prevents Mac users from executing commands to open a file or folder. That can happen while using the sudo or bash commands. Some reports state that the “Zsh: Permission denied” error might occur even when a file is opened in the root. Most customers indicate the error occurs when users try to open the installer file using the Terminal. It could be displayed while dragging the file into the Terminal window. But it might occur in any other folder. Therefore, don’t worry if you regularly get the “zsh: permission denied” error on your Mac’s terminal; we’ll explain how to fix it in this post. While using your computer’s terminal or command prompt, this error occasionally occurs. It will be extremely simple to fix and will assist in comprehending why and how it occurs. Let’s get started.
Why Are You Seeing The Zsh Permission Denied Error In the Terminal?
Several potential causes of the Zsh permission denied error on your Mac exist. Below are some of the most common.
The File Is Locked
Installing a program or changing a locked file is the most common cause of the permission denied error. You may not have administrator privileges, or the file may have been locked using child security by its creator. The permission error indicates that your command is attempting to write to a directory not owned by your user account.
Incorrect chmod X Or System Command
When a user attempts to use an invalid system command, this error occasionally occurs. Check to verify whether it is using the program’s command you are attempting to start if you are having difficulties getting it to launch. Permission denied errors may also occur when commands are submitted improperly.
The File’s Permissions Aren’t Sufficient
If you’re attempting to access or modify a file, use the terminal command ls -l file. ext. to check your permissions. If you need administrator access, use sudo to force the command.
How To Fix Easily Zsh Permission Denied Error In Mac Terminal?
Check File Permissions Using Terminal On Mac
You might get the “permission denied” error if you do not have permission to change the file. In that case, it’s recommended first to check the file permissions. A GUI or the Mac Terminal may be used to check file permissions. To do so, follow the steps below.
1 – Launch the Terminal by opening Utilities or the Mac Dock.
2 – Type the command below, including a space after the final character, but do not press the Enter key.
3 – Drag the file you wish to open into the Terminal window. By doing this, the command will automatically add the file’s location. The file, however, will not be relocated.
4 – Choose the Terminal window and hit Enter.
This will show if you can add to or edit the file.
Give Terminal Full Access To The Disk
Another reason the macOS terminal’s permission is denied is that the terminal needs to access the Disk completely. Illegal full disk access in terminal windows may also result in banned operation. To resolve this, follow these steps.
1 – In the top-left corner, click the Apple logo and select System Preferences from the drop-down menu.
2 – Choose Privacy from the Privacy and Security menu.
3 – Now, click the padlock in the lower-left corner of the window and type your user password.
4 – A list with a “Terminal” check box displays after entering your admin password.
The Disk will have complete access. Also, depending on the Mac update, some of you may want assistance locating Terminal in the list. By clicking the plus-shaped symbol, you may search for Terminal. Close the Terminal window for the modifications to take effect.
Use Sudo Commands
Almost any command may be executed from the Terminal using the simple Sudo command. Use sudo commands in the Terminal if you’ve encountered the Mac permission denied error. You may do this by appending sudo before the original command. Examples of commands are shown below.
sudo chmod 755 /dvtcolorconvert.rb
sudo chmod 755 ~/Themes/ObsidianCode.xccolortheme
Change Ownership Of The Directory
If none of the above fixes worked, try changing the directory ownership to your username. Change [username] to your username and [directorypath] to the path of the directory whose ownership you wish to change in the steps below. The folder can also be dragged into the Terminal window. You may use the chown command to modify the directory’s ownership. Hit the Enter key after typing the following command in Terminal.
chown -R $USER:$USER /path/to/directory
You should replace $USER with the user currently signed in and the path to the location you wish to write to.
Using CleanMyMac X To Reset The Terminal App
The Terminal is likely experiencing issues, so you see a “permission denied” error. One solution is to reset the app. The quickest way to accomplish this is using the handy app CleanMyMac X. Many modules in CleanMyMac X may improve your Mac, clear up space, defend it from viruses, and, most significantly, in this circumstance, fix issues.
1 – Open CleanMyMac X, then pick Uninstaller from the sidebar on the left.
2 – Use the search bar to locate the Terminal.
3 – Click the arrow when the file size has been opened.
4 – Check the Preferences and Supporting Files circles.
5 – By clicking the arrows next to Terminal, select Reset.
6 – Hit the Reset button.
The Bottom Line:
The Zsh permission denied error at the terminal typically occurs due to permissions issues with the files’ or directories’ permissions. Generally, you may resolve the ownership issue by altering the permissions or ownership. If it doesn’t work, restart the Terminal app using CleanMyMac X and check your command formatting. You would have found the solution to fix Zsh Permission Denied in Terminal on macOS Ventura or Monterey. We hope you found this post useful. If there is anything else you want to add that we haven’t previously addressed, please do so in the comments area to benefit the other readers. Also, please let us know if you have any queries concerning the guide.