背景:比如我在.bash_profile中設置了別名ll,每次都需要重新使用source .bash_profile才能生效。
原因:在 ~/.bash_profile 中配置環境變量, 可是每次重啓終端後配置的不生效.需要重新執行 : $source ~/.bash_profile
zsh加載的是 ~/.zshrc文件,而 ‘.zshrc’ 文件中並沒有定義任務環境變量。
解決辦法:在.zshrc裏面添加一行source .bash_profile
注意:如果mac上沒有安裝.zshrc或.bash_profile文件,需要手動添加!