我用的
zsh
,由于平時設定的環境變量都是在
.bash_profile
檔案中,每次重新開機iterm後,都需要重新開機手動加載
.bash_profile
檔案,很麻煩。
設定自動加載
.bash_profile
的方法如下:
在.zshrc配置檔案中調用.bash_profile檔案
打開zsh的配置檔案
.zshrc
,在最後面添加一行代碼
source /Users/chenchengda/.bash_profile
(也可以用相對路徑,不過我比較喜歡用絕對路徑,不容易出錯),這樣重新開機iterm便會自動加載
.bash_profile
檔案了。