Homebrew: Permission denied @ dir_s_mkdir macOS Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

Homebrew: Error: Permission denied @ dir_s_mkdir - /usr/local/Cellar / /opt/homebrew is not writable

Homebrew can't write to its prefix because the folders are owned by another user or root.

Exact message you may see Error: Permission denied @ dir_s_mkdir - /usr/local/CellarError: /opt/homebrew is not writablePermission denied @ dir_s_mkdirError: Permission denied @ rb_sysopen - /usr/local/Error: The following directories are not writable by your user
Seen on: macOS

Meaning

Homebrew should be owned by your user. Fix ownership with sudo chown -R $(whoami) $(brew --prefix)/* (Intel: /usr/local; Apple Silicon: /opt/homebrew), and make sure you never run sudo brew. brew doctor lists the exact problems.

Common causes

  • Installed with sudo or by another user
  • Ownership changed by migration/restore
  • Mixed Intel/ARM Homebrew prefixes
  • Running brew as root
  • Folder missing (/usr/local/share/man)

⚡ Quick fix

  1. sudo chown -R $(whoami) $(brew --prefix)/*
  2. brew doctor and fix what it reports
  3. Never use sudo brew

Detailed fix by platform

macOS

  1. brew --prefix && ls -ld $(brew --prefix) && brew doctor

How to diagnose

  1. Prefix — /opt/homebrew or /usr/local?
  2. Owner — You?
  3. Sudo — Used before?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

avc: denied — SELinux is preventing ... / avc: denied { read } for pid=... (permission denied despite correct permissions) (Linux)avc: denieddaemon — Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Docker)daemonDocker Desktop requires privileged access (vmnetd) — macOS: Docker Desktop needs privileged access / com.docker.vmnetd could not be started (macOS)Docker Desktop requir…EACCES — npm ERR! code EACCES — permission denied (npm)EACCESexec permission denied — exec /entrypoint.sh: permission denied (container won't start) (Docker)exec permission deniedHomebrew Cask: It seems there is already an App at — Homebrew: Error: It seems there is already an App at '/Applications/Chrome.app' (macOS)Homebrew Cask: It see…Homebrew: Failed to update / fatal: unable to access — Homebrew: Error: Failure while executing; `git fetch --force origin` exited with 128 / fatal: not in a git directory (macOS)Homebrew: Failed to u…Homebrew: No available formula with the name — Homebrew: Error: No available formula with the name "x". Did you mean ...? (macOS)Homebrew: No availabl…Homebrew:…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.