这意味着什么?我该如何解决?
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
这意味着什么?我该如何解决?
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
当前回答
我没有看到任何关于这个主题的自制信息的回答:https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh
要使Homebrew的完成功能在zsh中可用,必须在初始化zsh的完成功能之前在FPATH上获得Homebrew管理的zsh site-functions。将以下内容添加到~/。zshrc中:
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
这必须在调用compinit之前完成。
这为我解决了问题,无需手动更改所有权或其他方式。
其他回答
这是我在https://github.com/zsh-users/zsh-completions/issues/433#issuecomment-600582607上唯一有用的东西。感谢https://github.com/malaquiasdev !
$ cd /usr/local/share/
$ sudo chmod -R 755 zsh
$ sudo chown -R root:staff zsh
更新所有权限正确的文件/文件夹:
Compaudit | xargs chmod g-w
您不需要使用sudo更改所有者-除非文件属于root
(在macOS BigSur上测试)
上面列出的解决方案没有一个对我有效。相反,我最终卸载并重新安装了Homebrew,这很管用。卸载说明可以在这里找到:http://osxdaily.com/2018/08/12/how-uninstall-homebrew-mac/
当我sudo -i启动根shell时,我得到了相同的警告,@chakrit的解决方案对我不起作用。
但我发现-u开关的compinit工作,例如在你的.zshrc/zshenv或你调用compinit的地方
compinit -u
注意:不建议用于生产系统
参见http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization
这适用于我的Mac,因为High Sierra更新。
取消组写权限:
sudo chmod g-w /usr/local/share/zsh/site-functions
sudo chmod g-w /usr/local/share/zsh
最好将更改限制在zsh目录中。