1. 程式人生 > >Mac 每次都要執行source ~/.bash_profile 配置的環境變數才生效

Mac 每次都要執行source ~/.bash_profile 配置的環境變數才生效

自己在 ~/.bash_profile 中配置環境變數, 可是每次重啟終端後配置的不生效.需要重新執行 : $source ~/.bash_profile

發現zsh載入的是 ~/.zshrc檔案,而 ‘.zshrc’ 檔案中並沒有定義任務環境變數。

解決辦法

在~/.zshrc檔案最後,增加一行:
source ~/.bash_profile