Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zsh compinit: insecure directories error message on Mac, after installing Homebrew

After installing Homebrew and Homebrew-Cask on my Mac (as administrator with user-id 'admin', running MacOS 10.12.6), I get the error message

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

every time I start zsh. Investing the issue with compaudit, I found mentioned several insecure directories, most related to Homebrew - for example /usr/local/share/zsh/site-functions. This directory and its entries have access rights 0755, which should be OK, but - for example - the entry

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

which is a symlink to a file in Homebrew which defines the completions for zsh, has the owner admin. My guess is that zsh wants to see the user root here.

If this were Linux, I would simply change the owner of these files to root, or rather, I would have made the whole installation as root in the first place. In MacOS 10.12 however, they even "administrators" are not allowed to take full control over the system and while I can login as administrator, I don't even know the password of root.

Is there a clever solution to this problem? Or, can we teach zsh compinit somehow to never ask this annoying question and either accept the insecure directories, or skip over them? Or would it be best to login as admin, and simply delete the offending symlinks from site-functions? I can live with a completion system, which does not know how to handle brew commands.

like image 250
user1934428 Avatar asked Mar 06 '19 10:03

user1934428


1 Answers

My Mac is on macOS Monterey v12.1.

I got this message after brew install zsh-completions and after many tries with stackoverflow answers, I solved this problem with source .zshrc and compaudit | xargs chmod g-w,o-w.

I hope your problem will be solved too

like image 200
JLo Avatar answered Sep 24 '22 13:09

JLo