Fix: zsh: permission denied: claude
Error message:
zsh: permission denied: claude
What this message means
The shell found a file named claude and tried to run it. The operating system refused because that file is not marked executable, or because the folder that holds it is owned by root.
This is not the folder error where Cowork cannot read a project directory. That one usually says Permission denied, EACCES, or Operation not permitted, and the fix is to move the file into an allowed folder or grant that folder. See Permission Denied.
It is also not exit code 127. Exit code 127 means the shell could not find the command at all (command not found). Here the file exists. The shell is simply not allowed to execute it. See Exit Code 127 only if the message says command not found.
Why it happens
Two setups cause almost every report of this exact line:
- The Claude CLI file lost its executable bit. A copy, a partial install, or a restore can leave
/usr/local/bin/claude(or another path) on disk without+x. - A global npm install was done with
sudo. The binary andnode_modulesthen belong to root, so your user shell cannot runclaude.
Cowork's own sandbox can surface the same shell line when it tries to launch the CLI. Fix the file on your Mac first, in your own terminal, then retry the Cowork task.
Step-by-step fix
Step 1: Confirm which file zsh is refusing
Open Terminal (the macOS app, not a prompt inside Cowork) and run:
which claude
ls -l "$(which claude)"
which prints the path zsh would run. ls -l shows the permission bits at the left. If you see no x for your user, that is the problem. A common path is /usr/local/bin/claude. Use the path your Mac printed, not a guessed one.
If which claude prints nothing, you do not have this error. The command is missing, which is the exit code 127 case.
Step 2: Make that file executable
Replace the path below with the one from Step 1:
chmod +x /usr/local/bin/claude
Then check again:
claude --version
If that prints a version, retry the Cowork task.
Step 3: If npm owns the file, fix ownership instead of using sudo
If the binary came from a global npm install and Step 2 still says permission denied, take ownership of the npm folders:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
That command asks for your Mac password once so it can give those folders back to your user. After it finishes, install or update global tools without sudo.
Prefer this ownership fix over sudo npm install -g. Installing with sudo is what leaves the binary owned by root, so your shell cannot run it.
Step 4: Retry inside Cowork
Quit and reopen Claude Desktop, then run the same small task again. If Cowork still reports the line, paste the absolute path from which claude into the task so it does not pick up a different, non-executable copy.
Common pitfalls
- Treating this as a folder grant and turning on Full Disk Access. That does not add the executable bit to
claude. - Reinstalling with
sudo npm install -gand keeping the same root-owned folders. - Following the exit code 127 steps (nvm PATH, Homebrew path) when
which claudealready found the file. - Running
chmod +xon a guessed path whilewhichpoints somewhere else.
Prevention
- Install the official desktop app from claude.com/download. CoworkHow does not host installers.
- If you also use the CLI, install global npm packages as your own user.
- After a copy or restore, run
ls -l "$(which claude)"before starting a shell task. - Keep folder-access errors and this binary error on separate pages so the next fix stays narrow.
FAQ
Is zsh: permission denied: claude the same as a folder permission error?
No. Folder errors such as EACCES mean Cowork cannot read a directory you did not grant. This message means the claude file is on disk but the shell is not allowed to run it.
Is this the same as exit code 127?
No. Exit code 127 means the command was not found. This message means the file was found, but it is missing the executable permission or the npm folder is owned by root.
Should I reinstall with sudo?
Prefer not to. Make the existing binary executable with chmod +x, or take ownership of the npm prefix directories, then install global packages as your own user.
Related reading
- Permission Denied / File Access — folder grants and EACCES
- Exit Code 127 — command not found, PATH, and nvm
- System and Access Errors
- How to Fix Claude Cowork Common Errors
- Download Claude Desktop — official Mac and Windows app only