dra*_*ons 2 zsh iterm2 oh-my-zsh
每当我启动 iterm 终端时。我总是在终端上收到此消息,然后出现提示。
\n\nLast login: Fri May 1 21:33:59 on ttys001\n[oh-my-zsh] plugin \'zsh-syntax-highlighting\' not found\n[oh-my-zsh] plugin \'zsh-autosuggestions\' not found\n[oh-my-zsh] Insecure completion-dependent directories detected:\ndrwxrwxr-x 7 david admin 224 Apr 30 22:22 /usr/local/share/zsh\ndrwxrwxr-x 6 david admin 192 Apr 30 23:30 /usr/local/share/zsh/site-functions\n\n[oh-my-zsh] For safety, we will not load completions from these directories until\n[oh-my-zsh] you fix their permissions and ownership and restart zsh.\n[oh-my-zsh] See the above list for directories with group or other writability.\n\n[oh-my-zsh] To fix your permissions you can do so by disabling\n[oh-my-zsh] the write permission of "group" and "others" and making sure that the\n[oh-my-zsh] owner of these directories is either root or your current user.\n[oh-my-zsh] The following command may help:\n[oh-my-zsh] compaudit | xargs chmod g-w,o-w\n\n[oh-my-zsh] If the above didn\'t help or you want to skip the verification of\n[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to\n[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.\n\n\n~\n\xe2\x9e\x9c\nRun Code Online (Sandbox Code Playgroud)\n\n我该怎么做才能不显示上述所有[oh-my-zsh]消息并且我可以转到直接提示?我设置的时候有什么问题吗[oh-my-zsh]?
您似乎正在尝试使用未安装的插件。有关如何安装它们的信息,请参阅以下文档:
(基本上,您希望将存储库克隆到$ZSH_CUSTOM/plugins并在您的 中获取它们.zshrc,但请参阅每个文件的文档以了解要使用的实际命令。注意:zsh-syntax-highlighting必须是最后一个获取的插件。)
您问题的另一部分在终端输出中得到了回答:
要修复您的权限,您可以通过禁用“组”和“其他”的写入权限并确保这些目录的所有者是 root 或您的当前用户来实现。
看起来所有者已经是您当前的用户,但是您的权限是rwxrwxr-x,适用read, write, execute于用户和组以及read, execute其他人。从警告消息中,您应该从组中删除写入权限:
sudo chmod 755 zsh
Run Code Online (Sandbox Code Playgroud)
现在您ls -l应该看到rwxr-xr-x该目录。对目录执行相同的操作/usr/local/share/zsh/site-functions。
警告消息甚至为您提供了替代方案,建议您将以下内容放入~/.zshrc文件中并重新启动 zsh:
ZSH_DISABLE_COMPFIX="true"
Run Code Online (Sandbox Code Playgroud)