一、原因 最新系统的macbook把zsh作为默认shell,而环境变量添加到了bash中,把 bash shell 中.bash_profile 全部环境变量加入zsh shell里就可以啦 二、解决办法 1、打开终端,然后输入下面命令,查看.bash_profile的配置,复制 cat .bash_profile 2、然后输入下面命令打开.zshrc,把刚才.bash_profile复制的内容粘贴进来,然后:wq保存退出 vim .zshrc 3、输入下面命令更新配置 source ~/.zshrc