1. 程式人生 > >如何優雅的解決mac安裝zsh不執行.bash_profile

如何優雅的解決mac安裝zsh不執行.bash_profile

發現 log 沒有 etc 重裝 tro 解決 shell命令 環境

最近剛剛重裝了系統,並安裝了優雅的shell命令工具zsh,突然發現我放在我的工作目錄下的.bash_profile居然在啟動的時候執行,導致我的java的一些配置沒有註冊到bash中。然後查資料得知,安裝zsh後他會自動執行~/.zshrc文件,而裏面並沒有包含.bash_profile

一、Mac系統的環境變量,加載順序為:

/etc/profile

/etc/paths

~/.bash_profile

~/.bash_login

~/.profile

~/.bashrc

2. 在其最後面加入

if [ -f ~/.bash_profile ]; then
   source ~/.bash_profile
fi

即可完成

配置文件地址:

https://github.com/lonecloud/settings/zsh

如何優雅的解決mac安裝zsh不執行.bash_profile