我知道这里有很多这个问题的副本,但他们的所有答案都建议添加
ZSH_DISABLE_COMPFIX="true"
到我的 ~/.zshrc 文件的顶部。我已经这样做了,但每次打开 zsh 时,我都会受到欢迎zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
似乎其他问这个问题的人在第一个样本中没有引用真实的引号,但我已经添加了。我也跑了源 ~/.zshrc
据我所知,这会重新加载 zshrc 配置。这仍然给了我上述警告。我不确定这些细节中的任何一个是否相关,但我会包括它们:
知道如何解决此权限问题吗?谢谢
编辑:
comaudit 返回
/usr/local/share/zsh/site-functions
/usr/local/share/zsh
此外,这是我的 ~/.zshrc 文件中的其他非标准条目(按顺序排列,但中间有一些内置内容):ZSH_DISABLE_COMPFIX="true"
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export PATH=$HOME/bin:/usr/local/bin:$PATH
plugins=(git)
source $ZSH/oh-my-zsh.sh
zstyle :compinstall filename '/Users/jonahsaltzman/.zshrc'
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
autoload -Uz compinit
compinit
最佳答案
首先,这里的一个问题是您运行 compinit
两次:一次通过 Oh-My-Zsh(当你做 source $ZSH/oh-my-zsh.sh
时)和一次手动。您有两个选项可以解决此问题:
.zshrc
中删除底部 3 行文件。 plugins=(git)
和 source $ZSH/oh-my-zsh.sh
. 其次,请注意
$ZSH_DISABLE_COMPFIX
特定于 Oh-My-Zsh,compinit
不使用本身。拨打compinit
无效手动。您可以从 .zshrc
中删除它.最后,
compinit
不会无故显示该警告。与其压制它,不如做 chmod g-w,o-w
在 compaudit
列出的目录中.这将解决问题并使警告消失。
关于zsh - 如何解决zsh compinit : insecure directories issue on MacOS (other solutions failed),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65484115/