Permission Error Fixer

EACCES, permission denied - get the safe fix, not chmod 777.

  • $19 Free
  • 40 sec
  • No signup
1

Pick the error and where it happens

2

See the safe fix for your OS

3

Run it and verify

You get: The safe fix for your permission error, no chmod 777.

Which permission error?

Safe fixes only - no chmod 777, no reckless sudo. Runs client-side; nothing leaves your browser.

The safe fix

Claude Code permissions - macOS

Why it happened

A permission rule (or the default 'ask' behavior) stopped a tool or command from running. This is Claude Code's own guardrail, not the OS.

Do this in order

  1. Decide if you actually want to allow it. If yes, add an allow rule; if it should always stop, leave it as ask/deny.
  2. Open .claude/settings.json and add the rule under permissions.allow, e.g. "Bash(npm run test:*)" or "Read(./src/**)".
  3. Scope the rule tightly - allow the specific command or path pattern, not a blanket wildcard for the whole tool.
  4. Restart the session so the updated settings load, then re-run the action.
  5. Use the Permissions Rule Builder tool on this site to generate the exact allow/ask/deny block without guessing the syntax.

Two kinds of permission errors

When Claude Code says 'permission denied', it is one of two very different things - and telling them apart is the whole game. Either the operating system refused a file operation (classic EACCES/EPERM, usually from npm or from files owned by root), or Claude Code's own permission system stopped a tool or command per your settings.json rules. The fix for an OS error is about ownership and rights; the fix for a Claude Code block is about allow/ask/deny rules. Pick your error above and this tool gives you the safe fix for the right layer.

The word 'safe' matters here. There is a tempting shortcut for OS permission errors - chmod 777 or sudo - that makes the error disappear and quietly opens a security hole or plants root-owned files that break again later. This tool never recommends those. Every fix here is scoped to the minimum change that actually resolves the cause.

Claude Code permission rules: allow, ask, deny

  • Allow - the tool or command runs without prompting. Scope it tightly to a command or path pattern.
  • Ask - Claude Code pauses and asks you before running. This is the safe default for anything with side effects.
  • Deny - the tool or command is blocked outright, and deny wins over allow. Use it for things you never want to happen.
  • Precedence: deny beats ask beats allow. If something is blocked despite an allow rule, a deny rule is overriding it.
  • Layers: rules live in project .claude/settings.json and in your global ~/.claude/settings.json. Check both.

Never chmod 777, never sudo npm -g

chmod 777 makes a file world-writable - a real security risk, not a fix. `sudo npm install -g` plants root-owned files that cause the same EACCES again next time. The correct fix for npm is a user-owned global prefix. Reclaim wrongly-owned files with targeted `chown`, not a blanket permission blast.

The correct fix for npm EACCES

  1. Give npm a folder your user owns: `mkdir -p ~/.npm-global`.
  2. Point npm at it: `npm config set prefix ~/.npm-global`.
  3. Add its bin to your PATH in your shell profile and open a new terminal.
  4. Reinstall the global package without sudo.
  5. If earlier sudo installs left root-owned files, reclaim just those: `sudo chown -R $(whoami) ~/.npm ~/.npm-global`.
  6. Confirm with a fresh global install that no longer throws EACCES.

Fixing a blocked tool the right way

When Claude Code blocks a tool, the instinct is to open the permissions wide. Resist it. The value of the permission system is that it stops a runaway command before it does damage. When you add an allow rule, scope it to exactly what you need - allow `Bash(npm run test:*)`, not `Bash(*)`. Allow reads of `./src/**`, not the whole filesystem. A tight allow rule keeps the guardrail useful for everything except the specific thing you just approved. The Permissions Rule Builder tool generates these blocks with correct syntax so you are not guessing.

Why the same error keeps coming back

A permission error that returns every session is almost always an ownership problem you papered over. If you once ran `sudo npm install`, your npm folders are now root-owned, and every future global install fails the same way until you reclaim ownership. If you chmod'd a file to make one error go away, the underlying wrong owner is still there. The durable fix is to correct ownership once - user-owned npm prefix, targeted chown on stray root files - rather than re-fighting the symptom each time.

A permission setup that stays out of your way

The goal is a setup where permissions protect you without nagging you. That means: a user-owned npm prefix so global installs never hit EACCES, a small set of tight allow rules for the commands you run constantly, ask on anything with real side effects, and deny on the handful of things you never want. Get that dialed in once and permission errors become rare and meaningful rather than constant friction. The Claude Code Club setup module builds this out step by step.

Frequently asked questions

  • Is my 'permission denied' an OS error or a Claude Code block?

    If it mentions EACCES, EPERM, or a file path (often during npm install), it is the operating system. If Claude Code says a tool was blocked or asks for approval, it is Claude Code's own permission rules in settings.json. The two need different fixes.

  • Why should I never use chmod 777?

    chmod 777 makes a file readable and writable by every user on the machine - a genuine security hole. It also does not address the real cause (wrong ownership). Use a targeted `chown` to fix ownership, or `chmod u+w` to add just the one bit you need.

  • How do I allow a command Claude Code keeps blocking?

    Add a scoped allow rule to permissions.allow in .claude/settings.json, like "Bash(npm run test:*)" - the specific command, not a blanket wildcard. Restart the session so it loads. The Permissions Rule Builder tool generates the exact syntax.

  • I added an allow rule but it is still blocked. Why?

    A deny rule is overriding it. Precedence is deny beats ask beats allow. Search both your project .claude/settings.json and your global ~/.claude/settings.json for a matching deny entry and narrow or remove it.

  • Why does npm EACCES keep coming back after I sudo?

    Because `sudo npm install -g` creates root-owned files in your npm folders, so the next non-sudo install fails the same way. Fix it for good: set a user-owned prefix (`npm config set prefix ~/.npm-global`) and reclaim any root-owned files with `chown`.

  • Claude Code cannot access a folder outside my project. Is that a bug?

    No, it is by design - Claude Code works within the directory you launched it in. Start the session from a directory that contains what you need, or add an appropriate allow rule for the extra path. Do not broaden OS permissions to work around it.

Liked this tool? The club is the next step.

Join Claude Code Club for $9/month. 650+ lessons, weekly updates, and the workflows behind every tool on this site.

  • No experience needed
  • Cancel anytime
  • Updated weekly