How to fix "zsh compinit: insecure directories"?

Solution 1:

This made the error go away:

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

I'm still unsure what the error meant or why it happened, though.

Credit: this answer on StackOverflow which in turn got the solution from a post on the zsh mailing list

Solution 2:

I simply followed what was written there.

zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? 

I ignored these. After that, I ran compaudit,

# compaudit

It showed me 2 directories,

/usr/local/share/zsh/
/usr/local/share/zsh/site-functions/

So, insecure means something is wrong with their permissions, I changed the permissions to secure them and the error went away.

I also checked that both directories were empty, so I deleted both of them, which I would not recommend, but still I did.

Solution 3:

To Fix Error

zsh compinit: insecure files, run compaudit for list. Ignore insecure files and continue [y] or abort compinit [n]?

I ran 2 commands:

command 1.

compaudit

output:

There are insecure files:
/usr/share/zsh/vendor-completions/_code

Then I ran:

command 2.

sudo chown root /usr/share/zsh/vendor-completions/_code

cheers