如何优雅的解决mac安装zsh不执行.bash_profile

时间:2023-03-09 08:47:53
如何优雅的解决mac安装zsh不执行.bash_profile

最近刚刚重装了系统,并安装了优雅的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