Macbook - 为何bash_profile在zsh不生效

Macbook - 为何bash_profile在zsh不生效

自从苹果的 catalina 版本系统推出后,官方将默认的 shell 由 bash 改成了 zsh,这样我们之前的 bash_profile 中的配置失效了。原因:

  • .bashrc 在 zsh 下应该为 .zshrc
  • .bash_profile 在 zsh 下应该为 .zprofile

解决办法:

  • 创建一个新的文件.zprofile
1
cd ~ && echo 'source ~/.bash_profile' > .zprofile
  • 重启终端即可
Rating: