What does it mean and how can I fix it?
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
Running the compaudit
returns the follows:
There are insecure directories:
/usr/local/share/zsh/site-functions
On macOS Sierra you need to run:
sudo chown -R $(whoami):staff /usr/local
run
compaudit
and it will give you a list of directories it thinks are insecuresudo chown -R username:root target_directory
sudo chmod -R 755 target_directory
I got the same warnings when I
sudo -i
starting a root shell, @chakrit's solution didn't work for me.But I found
-u
switch ofcompinit
works, e.g. in your .zshrc/zshenv or where you calledcompinit
NB: Not recommended for production system
See also http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization
Most answers come with a solution, but do not mention why this warning occurs. Here's an excerpt from ZSH's compinit:
Hence, the solution implies fixing one (or all) of the following:
setting the current user as the owner of all the directories/subdirectories/files in cause:
removing write permissions for group/others for the files in cause:
Another approach would be to skip these checks by using
but I don't really suggest this, as hiding problems under a rug only solves problems in the short run.
This was the only thing that worked for me from https://github.com/zsh-users/zsh-completions/issues/433#issuecomment-600582607. Thanks https://github.com/malaquiasdev!
I fixed it by doing
in my case other directories inside share/ also have "staff" group assigned