Zsh: Permission Denied: How to Fix the Error on Mac?

Mahima Dave Written by Mahima Dave
Updated on
Jun 02, 2026

Did you run into a “zsh: permission denied:” error while trying to run a command or script in Terminal on your Mac? If yes, do not panic. macOS is simply blocking a command, script, or file because it does not have the required permission to run.

Missing execute permissions, incorrect file paths, and Terminal access issues are usually the cause of this error. In this guide, I will explain the Mac Terminal Permission Denied error, why it happens, and the safest ways to fix it.

What Does zsh: permission denied Mean on Mac?

The zsh: permission denied error appears when Terminal tries to open, run, edit, or access something that macOS blocks for security reasons. In simple terms, your Mac is trying to say: “You do not currently have permission to do this.”

zsh permission denied error in Terminal

macOS uses Unix-based file permissions where every file has separate read, write, and execute rules. If the required permissions are missing, zsh (a Unix shell) blocks the command immediately instead of letting it run.

That is why even a normal command can fail and show you “Failed to generate content: permission denied. Please try again.” 

Also Read

Why Are You Seeing the zsh Permission Denied Error?

If you see permission denied in the Mac Terminal, one of the following causes is usually responsible.

  • The File is Not Executable: This is the most common reason. On macOS, scripts and executable files need execute permissions before Terminal allows them to run. If the file only has read and write access, zsh blocks execution.
  • No Administrator Access: Some Terminal commands modify protected system locations or settings. macOS requires administrator privileges for those actions.
  • macOS Security Restrictions: Newer macOS versions are stricter about privacy and file access. Even if the command is correct, it may fail if:
    • The terminal lacks full disk access.
    • The file was downloaded from the internet.
    • Apple quarantine protection is live.

    This commonly affects downloaded scripts and developer tools.

  • Incorrect .zshrc Permissions: Sometimes the issue is with the .zshrc file itself. If it has broken permissions or invalid commands, Terminal may show the zshrc permission denied on Mac.

The important thing to understand is that, unlike errors like Mac Computer Freezing or Mac Pink Screen, this error is usually about permissions, not a broken Mac.

How to Fix zsh: Permission Denied on Mac?

All you need to do is follow the given approach to fix this Terminal error. Also, stay away from copying random Terminal commands from forums. 

Fix 1: Make Sure You are Using the Correct File Path

A surprisingly common mistake is trying to run a script without specifying its path properly.  For example, using “script.sh” instead of “./script.sh” may fail even if the script is executable.

Here is a quick rule you should know:

  • Use “./script.sh” to run from the current folder.
  • Use “/full/path/script.sh” to run from an exact location.

Without the correct path reference, Terminal may fail to execute the file properly.

Fix 2: Check File Permissions Properly

Before changing permissions blindly, inspect them first. Here’s how:

  • Open Terminal and type “ls -l”.
  • Then, drag the file or folder you want to use and press Return.
  • Now, you will see something like the following output:
    Check File Permissions in Terminal

Now look at the “-rw-r–r–” part. “ Here, r means read and w means write. If you do not see x (execute), the file cannot run yet. A working executable file usually looks like: “-rwxr-xr-x”. 

Fix 3: Make the File Executable Using chmod

This is the first thing you should try when you see the Terminal permission denied error. Here’s what you need to do:

  • Open the Terminal app on your Mac.
  • Use “cd YourScriptDirectory” to enter the directory that contains the file you want to execute.
  • Now, use the “chmod 755 filename.sh” or “chmod +x filename.sh” command to make the file executable.
  • Then, just normally run: “./filename.sh”.

The “+x” or “755” adds execute permission to the file. Without execute permission, Terminal cannot run the file. 

Fix 4: Run the Command with sudo

Some macOS files and folders are intentionally protected. If your command modifies system files, protected directories, and configuration files, you may need administrator privileges.

  • After giving execution rights, just type “sudo” before the usual command. For example: “sudo ./your_file”.
  • If the file is owned by a different user, run: “sudo chown $(whoami) /path/to/your/file”.

macOS may ask for your password before running the file. Also, do not blindly add sudo to every command. It gives deep system access, and one incorrect command can damage important settings or permissions.

Fix 5: Give Terminal Full Disk Access

Even correct commands can fail if the Terminal lacks proper macOS permissions. To enable Full Disk Access:

  • Open System Settings and go to Privacy & Security.
  • Next, open Full Disk Access.
    Click on Full Disk Access
  • Here, enable Terminal and restart the Terminal app.
    Enable Terminal

This is especially useful when scripts interact with Documents or the Desktop folder, external drives are involved, and developer tools fail unexpectedly.

Fix 6: Remove Apple Quarantine Restrictions

File downloads from the internet may carry Apple’s quarantine flag. macOS can block those files and show “/.zshrc permission denied” even after they become executable. 

  • To check quarantine status, use: “xattr -l filename”.
  • To remove quarantine, use: “xattr -d com.apple.quarantine filename”

Do this for trusted files only. This commonly affects GitHub downloads, Shell scripts shared online, and developer tools. 

Also Read

How to Prevent the Permission Denied Error from Coming Back?

Most people fix the MacBook Terminal permission denied issue once, but repeat the same habits later. These practices can help you avoid recurring permissions problems.

  • Many tutorials suggest “chmod 777”. This gives unnecessary access to everyone and weakens security. Only use the permission you actually need.
  • Double-check every command before running it in the Terminal. Small typos can trigger permission errors.
  • Be careful while editing .zshrc and create a backup. A broken.zshrc file can cause Terminal errors every time it opens.
  • Instead of disabling security features completely, verify the file permissions and use trusted sources only.

Carefully following these simple habits is crucial for a safe and long-term approach. 

Final Thoughts

The zsh permission denied Mac error may look intimidating at first, but usually, macOS is simply protecting your system from unsafe execution.

Try to make the file executable, use the correct file path, grant Terminal proper access, and avoid broken configurations. Once you understand how macOS permissions work, these Terminal errors become much easier to troubleshoot.

Also Read

Frequently Asked Questions

What is zsh: permission denied on a Mac?

It is a Terminal error that appears when macOS blocks a file, script, or command because the required permissions are missing.

Why does macOS Terminal say permission denied?

It happens when the file is not executable, administrator privileges are required, Terminal lacks Full Disk Access, or file ownership or permissions are incorrect.

How to fix permission denied in macOS Terminal?

Try using “chmod +x” to execute files, running commands with sudo, and enabling Full Disk Access for Terminal.

What does chmod +x do on Mac?

It adds execute permission to a file, allowing Terminal to run it as a script or executable file.

Can .zshrc cause permission denied errors?

Yes, incorrect .zshrc permissions or broken startup commands can trigger a Terminal permission error when a new shell session opens.

Sources
Related Posts
Firmware Update
Operating System Jul 14, 2026
What is Firmware Update? Meaning, Benefits, and How It Works

You probably don’t think about firmware until your device asks you to update it. Whether it is your Wi-Fi router,…

ubuntu
Operating System Jul 14, 2026
Install Deb File Ubuntu: How to Install a .deb File Safely

Installing a deb file in Ubuntu is easier than it sounds once you know the right method. While Ubuntu supports…

How to Update Drivers in Windows 11 and Windows 10 (2026 Guide)
Operating System Jul 13, 2026
How to Update Drivers in Windows 11 and Windows 10 (2026 Guide)

An outdated driver can cause a range of problems, from Wi-Fi issues and audio glitches to display and Windows update…

mac tahoe vs sequoia
Operating System Jul 10, 2026
Mac Tahoe vs Sequoia: Which macOS Version Should You Choose?

Choosing between macOS Tahoe and Sequoia comes down to more than just getting the newest version. While Tahoe introduces a…

how to fix slow boot mac
Operating System Jul 10, 2026
How to Fix Slow Boot Mac: 10 Proven Ways to Improve Startup and Performance

Why is my MacBook running so slowly? This is one of the most asked questions I get. Well, a Mac…

Path of a File in Mac
Operating System Jul 08, 2026
How to Get Path of a File in Mac? (5 Simple Methods)

Need to paste a file path into Terminal or share a file’s exact location, but don’t know how to get…

Exit Full Screen on Mac
Operating System Jul 07, 2026
How to Exit Full Screen on Mac (4 Easy Methods)

Full Screen mode on a Mac helps you focus by hiding the dock and menu bar. But there are times…

System Preferences on Mac
Operating System Jul 03, 2026
Where is System Preferences on Mac? How to Open and Use It

If you are looking for System Preferences on Mac but can’t find it, you are probably using a newer version…

Right click on a Mac
Operating System Jul 02, 2026
How to Right click on a Mac? Learn the 7 Tried and Tested Methods

Being a first-time MacBook user can be a bit challenging at times because you might  be just practising new sets…