macOS多用户使用oh-my-zsh及其权限问题的解决

我的机器上oh-my-zsh首次安装是在simonliu用户下,如果为了避免重复安装,需要在新用户账号下做这几件事:

  1. 建立一个符号连接
sudo ln -s $HOME/.oh-my-zsh  /Users/simonliu/.oh-my-zsh
  1. 新建~/.zshrc
    内容如下:
ZSH_DISABLE_COMPFIX="true"
# Path to your oh-my-zsh installation.
export ZSH=/Users/simonliu/.oh-my-zsh

ZSH_THEME="agnoster"

# Add wisely, as too many plugins slow down shell startup.
plugins=(
    git
    zsh-syntax-highlighting
    osx
)
source $ZSH/oh-my-zsh.sh
source $ZSH/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

然后source ~/.zshrc使其生效即可。
其中ZSH_DISABLE_COMPFIX="true"是为了解决权限问题,如果没有这一句,就会有如下错误提示:

#错误提示
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxr-xr-x   17 simonliu  staff   544 Feb 22 15:17 /Users/simonliu/.oh-my-zsh
drwxr-xr-x    4 simonliu  staff   128 Dec 27  2018 /Users/simonliu/.oh-my-zsh/custom/plugins
drwxr-xr-x   21 simonliu  staff   672 Dec 27  2018 /Users/simonliu/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
drwxr-xr-x  257 simonliu  staff  8224 Dec 27  2018 /Users/simonliu/.oh-my-zsh/plugins
drwxr-xr-x    4 simonliu  staff   128 Dec 27  2018 /Users/simonliu/.oh-my-zsh/plugins/git
drwxr-xr-x    5 simonliu  staff   160 Dec 27  2018 /Users/simonliu/.oh-my-zsh/plugins/osx
drwxr-xr-x    3 simonliu  admin    96 Sep 25  2016 /usr/local/share/zsh
drwxr-xr-x    8 simonliu  admin   256 Jul 22  2019 /usr/local/share/zsh/site-functions
lrwxr-xr-x    1 simonliu  admin    39 Sep 25  2016 /usr/local/share/zsh/site-functions/_brew -> ../../../Homebrew/completions/zsh/_brew
...

你可能感兴趣的:(MacOS)