zsh: permission denied Error: Key Causes and Fixes

Almost every user of ZSH – a powerful, extensible shell for interactive use and scripting – has encountered the daunting “zsh: permission denied” error at one point or another. This error often leads to frustration, especially for new users who might not be aware of the underlying cause behind it. Whether you’re working on a Mac or Windows system, understanding the root of the issue and how to troubleshoot it effectively becomes essential.

Table of Contents

What Causes the “zsh: permission denied” Error?

The tricky pop-up, “zsh: permission denied” usually surfaces when you’re attempting to execute a command or script without the appropriate permissions. This situation can emerge when a command or script is marked as non-executable, or you don’t have enough access rights to invoke it. Now, let’s delve into resolving this error.

A Step-by-step Guide to Resolving “zsh: permission denied” on Mac

Before we start, it’s worth noting that ZSH comes pre-installed on macOS Catalina and later versions, but if you’re using older macOS or wish to install a newer ZSH version, you can follow the guidelines outlined here.

To resolve the “zsh: permission denied” error on Mac, follow these simple steps:

  1. Open your terminal: You can find the terminal in your utilities or search for it via Spotlight.
  2. Identify the non-executable file: Use the ls -l command. If the output doesn’t have an ‘x’ marked, it’s a non-executable file. E.g., -rw-r--r--.
  3. Grant execute permissions: You can modify the file’s permissions using the chmod command followed by ‘+x’, and then the file name. For example, chmod +x filename.
  4. Re-run the command or script: The “zsh: permission denied” error should now be resolved.

Resolving “zsh: permission denied” Error on Windows

On Windows, you may encounter this error while using WSL (Windows Subsystem for Linux) or Cygwin. Here are the steps fix “zsh: permission denied” error:

  1. Launch your WSL or Cygwin terminal: Click on the app or use the search function to find and open it.
  2. Identify the issue: Similar to Mac, use the ls -l command to find out if the file lacks sufficient permissions.
  3. Change the permissions: Use the chmod command with ‘+x’ and then the file name to modify permissions. For instance, chmod +x filename.
  4. Try running the script or command again: The error should be fixed now.

For more advanced users, these errors might be an opportunity to learn more about shell properties, configuration files, and advanced scripting. One of the recommended books is “From Bash To Z Shell: Conquering The Command Line” that you might find interesting.


Running into a “zsh: permission denied” error can be both frustrating and confusing even for seasoned developers. However, understanding its causes and knowing how to fix it can alleviate these challenges. Armed with this step-by-step guide, you can effectively troubleshoot this issue both on Mac and Windows systems. Echoing the age-old coding maxim, “Understanding the problem is half the solution”, makes troubleshooting a substantial part of a developer’s journey.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap