背景:比如我在.bash_profile中设置了别名ll,每次都需要重新使用source .bash_profile才能生效。
原因:在 ~/.bash_profile 中配置环境变量, 可是每次重启终端后配置的不生效.需要重新执行 : $source ~/.bash_profile
zsh加载的是 ~/.zshrc文件,而 ‘.zshrc’ 文件中并没有定义任务环境变量。
解决办法:在.zshrc里面添加一行source .bash_profile
注意:如果mac上没有安装.zshrc或.bash_profile文件,需要手动添加!