I have errors with the zsh shell:

zsh compinit: insecure directories and files, run compaudit for list

the files listed with errors are


People suggest to change the ownership of these to the user having the problem.

sudo chown -R $(whoami):staff /usr/local/share/zsh

But I have multiple users in my mac so this doesn't make sense. Beside /usr/local stuff should be run by any user AFAIK.

Further to this the user with the problem is not in the sudoers list, so if I run the above command with the admin user won't fix it.

Permissions currently look like this

drwxr-xr-x 8 userwithAdmin staff 256 19 Nov 15:18 site-functions

the user with the problem is not userwithAdmin but userB.

Any suggestions?

  • Who was the original owner - zsh manual zsh.sourceforge.io/Doc/Release/Completion-System.html says it should be root or current owner - so with multiple users it must be root
    – mmmmmm
    Dec 3, 2021 at 12:28
  • @mmmmmm I've no idea who the original owner was, I've changed it to root but the problem remains. Dec 3, 2021 at 12:31
  • 1
    By any chance are you running homebrew?
    – mmmmmm
    Dec 3, 2021 at 13:21
  • @mmmmmm yes this is probably homebrew related. Dec 3, 2021 at 13:31
  • Homebre messes up Unix permissions by making /usr/local writable by a user. So choose homebrew or zsh compinit. Homebrew is designed as if there is one user on the machine. If you have multiple then use another package manager eg macports or fink that are designed as normal unix usage and so require sudo to install
    – mmmmmm
    Dec 3, 2021 at 13:34

1 Answer 1


As @mmmmmm suggested this is related to brew installation.

Actually I applied the suggestion by @Alf Eaton here: https://stackoverflow.com/questions/13762280/zsh-compinit-insecure-directories

chmod -R go-w "$(brew --prefix)/share"

and it solved the problem. I can't explain but it worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .