The Zsh: permission denied: / error in Terminal explained

4 min read

Has the zsh: permission denied: / error message in Terminal left you scratching your head? If you've got a permission error like the one below, look no further! We've put together everything you need to know in this article, including all possible fixes and solutions.

zsh: permission denied: / error message

What is Zsh on a Mac?

Alright, let's start from the very beginning. On a Macbook, the Shell is a command-line interpreter that can process various commands within scripts on Terminal.

The Terminal application allows users to operate their devices and execute specific tasks with various scripts and commands such as:

  • Show hidden files and folders,

  • Move files and folders,

  • Download files without a browser.

Originally, the bash was the default shell used on macOS, but since macOS Catalina, the default changed to Zsh or Z shell.

Zsh is built upon bash and is essentially an extended version with more features. In fact, using it is a no-brainer with the little cherry on top: some tasks don't require strict user permissions anymore, unlike bash.

You could think of Zsh as the text input interface that brings our Mac's hardware to life via Terminal.

You can see which Shell your Terminal is operating by looking at the top of any open Terminal window. 

Zsh error in Terminal

Notice your username, the shell name, and the window's dimensions.

If you've been trying to open a file using Terminal and came across the Zsh: permission denied: / error message, keep reading!

What does Zsh: permission denied on Mac mean?

Error messages like permission denied on Terminal mean that you’ve entered the command that couldn't be completed due to a problem with file access. Often, it can be caused by these three common reasons:

  • You entered the wrong command

  • Your file is locked

  • You don't have permission or admin rights to edit or alter the file

It's not always easy to identify why you're having file or folder permission access issues. Sometimes, they simply get broken.

You can often fix and prevent these issues by regularly running the Maintenance module in the CleanMyMac X. It has a specific tool that repairs disk permissions and restores broken files and folders access in a few clicks. 

Download the free version here, then follow the steps below:

Repair disk permissions in Maintenance module CMMX

  1. Open the app and press Maintenance in the sidebar.

  2. Press View all Tasks.

  3. Select Repair Disk Permissions and press Run. 

If you want to try options that do not include downloading an extra tool to tackle this challenge, jump to the next section for more troubleshooting tips.

How to solve the "Zsh: permission denied" error

Before diving into any of the below-troubleshooting tips, it's wise to back up your data with Time Machine, just in case anything goes wrong. Here's how:

System Preferences - Time Machine

  1. Be sure your external storage device is connected.

  2. From the main Apple menu > System Preferences > Time Machine.

  3. Press Select Backup Disk, pick your external drive, and click Use Disk.

Before wasting time on advanced troubleshooting, try these manageable hacks first. 

1. Check your input text

Ensure you've inputted the correct command text. Yes, this may sound glaringly obvious, but it's surprising how many people miss a space or character from the command line. 

2. Check file permissions 

First, let's start by checking the file permissions; here's how:

file permissions

  1. Open Finder > Applications > Utilities > Terminal.

  2. Enter the below command followed by a space:

    ls -l

  3. Now, find the file you were working with when you received the error notification and drag it into the Terminal window. Then, press Enter.

  4. Before your username, you should see a string of characters

    • rwxr means you can read, write, and execute the file.

    • r means read-only.

    3. Modify file permissions

    If, after completing the above steps, you’ve discovered that permissions don't allow you to write a file, that's most likely the cause of the zsh: permission denied: / error message.

    Looking for a fix? Try this: 

    Zoom info

    1. Locate your file, right-click on it, and press Get Info.

    2. Press the lock icon bottom right to make or save changes.

    3. Under Sharing & Permissions, locate your user profile under Name.

    4. Now, under the Privalidge column, change this to Read & Write.

    4. Adjust directory ownership

    If modifying the file permission didn't fix the issue, try adjusting the directory's ownership using the chown command.

    1. Open Terminal, and enter the below command, but change $USER to your username and /path/to/directory to the path you want to write.

      chown -R $USER:$USER /path/to/directory
    2. Press Enter.

    5. Ensure Terminal has full access to the drive

    In some cases, Terminal doesn't have full access to the drive, which could also be one of the reasons you're unable to open files. Here's what you should do to fix this:

    System Preferences > Security & Privacy

    1. Select the main Apple menu > System Preferences > Security & Privacy.

    2. Select the Privacy tab.

    3. Press the lock icon bottom right to make changes.

    4. Locate Full Disk Access from the list.

    5. To add Terminal, press the + button and find Terminal from within the Utilities folder.

    Zsh: permission denied on Mac is an unpleasant matter, but hopefully, these easy-to-follow tips will help you to solve this problem. Now you have a blueprint of what should be done if you ever reencounter this error. Keep an eye on more Mac tips and hacks from us! 

    Follow us
    Blog FAQ
    How to

    MacPaw uses cookies to personalize your experience on our website. By continuing to use this site, you agree to our cookie policy. Click here to learn more.