Install zsh-completions using Homebrew on MacOS 12.1 Monterey

When we install zsh-completions using Homebrew, we could follow the instructions from here. However, there's caveat: when start zsh-completions, you might see the following errors:

zsh compinit: insecure directories" warnings

The document above provided the following solution, which does not work on MacOS 12.1:

Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting to load these completions, you may need to run this:

chmod -R go-w '$(brew — prefix)/share/zsh'

You can verify yourself after above command line by running

compaudit

Running compaudit

to really solve this issue, you can run the following command:

compaudit | xargs chmod g-w

None

As you could tell, after above command line, when we ran comp audit again, there's no errors.

HTH