这意味着什么?我该如何解决?

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

运行compaudit将返回如下结果:

There are insecure directories:
/usr/local/share/zsh/site-functions

当前回答

我通过做来解决它

sudo chown -R root:staff /usr/local/share/zsh

在我的例子中,share/中的其他目录也分配了“staff”组

其他回答

删除组写权限

compaudit | xargs chmod g-w

会成功的。

参见http://www.wezm.net/technical/2008/09/zsh-cygwin-and-insecure-directories/

我通过做来解决它

sudo chown -R root:staff /usr/local/share/zsh

在我的例子中,share/中的其他目录也分配了“staff”组

更新所有权限正确的文件/文件夹:

Compaudit | xargs chmod g-w

您不需要使用sudo更改所有者-除非文件属于root

(在macOS BigSur上测试)

我的建议是运行compaudit,然后修复由审计发现的目录的权限。 确保识别的目录没有组或其他的写权限。

当我sudo -i启动根shell时,我得到了相同的警告,@chakrit的解决方案对我不起作用。

但我发现-u开关的compinit工作,例如在你的.zshrc/zshenv或你调用compinit的地方

compinit -u

注意:不建议用于生产系统

参见http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization