zsh compinit: insecure directories, run compaudit for list

You can list those insecure folders by:

compaudit

The root cause of "insecure" is these folders are group writable.

There's a one line solution to fix that:

compaudit | xargs chmod g-w

Please see zsh, Cygwin and Insecure Directories and zsh compinit: insecure directories for reference.


I encountered the same problem after following https://docs.npmjs.com/getting-started/fixing-npm-permissions, and I solved it using:

% cd /usr/local/share/zsh
% sudo chmod -R 755 ./site-functions
% sudo chown -R root:root ./site-functions

I found the answer here: https://stackoverflow.com/questions/13762280/zsh-compinit-insecure-directories


I'm using WSL and the above solutions didn't fix it for me, but they did lead me towards this incantation which did fix it:

cd ~
compaudit | xargs chown -R "$(whoami)"
compaudit | xargs chmod -R go-w