问题描述
在Mac上安装Homebrew和Homebrew-Cask之后(以具有用户ID'admin'的管理员身份运行MacOS 10.12.6),我收到错误消息
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]?
每次我启动zsh时.用compaudit投资问题时,我发现提到了几个不安全的目录,其中大多数与Homebrew有关-例如/usr/local/share/zsh/site-functions
.该目录及其条目的访问权限为0755,应该可以,但是-例如-条目
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
是到Homebrew中定义zsh补全的文件的符号链接,拥有者 admin .我的猜测是zsh想在这里看到用户 root .
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.
如果这是Linux,我只需将这些文件的所有者更改为 root ,或者说,我首先将整个安装作为root进行.但是,在MacOS 10.12中,甚至管理员"都不能完全控制系统,尽管我可以以管理员身份登录,但我什至不知道root的密码.
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.
是否有解决此问题的聪明方法?或者,我们是否可以以某种方式教zsh compinit永远不要问这个烦人的问题,要么接受不安全的目录,要么跳过它们?还是最好以管理员身份登录,然后从 site-functions
中删除有问题的符号链接?我可以使用一个完成系统,该系统不知道如何处理 brew
命令.
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.
推荐答案
我发现,错误消息是由对 .zshrc
中的 compinit
的调用生成的,并且可以通过传递 -i
选项将其关闭,即
I found, that the error message was generated by a call to compinit
in my .zshrc
, and that it can be turned off by passing the -i
option, i.e.
compinit -i
虽然这可以解决问题,但是Ortomala Lokni提出的有关应使用用户权限安装Homebrew的论点也值得考虑-仅Homebrew不允许我这样做;但这是一个单独的主题.
While this solves the problem, the argument brought by Ortomala Lokni that Homebrew should be installed using user privilege, is also worth considering - only that Homebrew does not allow me to do this; but this is a topic for a separate thread.
这篇关于zsh compinit:安装Homebrew后在Mac上出现目录不安全错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!