我用的zsh,由於平時設置的環境變量都是在.bash_profile
文件中,每次重啓iterm後,都需要重啓手動加載.bash_profile文
件,很麻煩。
設置自動加載.bash_profile
的方法如下:
在.zshrc
配置文件中調用.bash_profile
文件
打開zsh的配置文件.zshrc
,在最後面添加一行代碼source /Users/mymac/.bash_profile
(也可以用相對路徑,不過我比較喜歡用絕對路徑,不容易出錯),這樣重啓iterm便會自動加載.bash_profile
文件了。
參考: https://blog.csdn.net/gnail_oug/article/details/79786269