问题描述
系统更新后,~/.bash_profile里导出的路径无法被读取到
使用 source ~/.bash_profile
后可以加载导出的path路径,但是仅限于本此会话,关闭重新打开后无效
在终端中echo $PATH
发现只加载了mac默认的path路径
Mac系统的环境变量,加载顺序为:
- /etc/profile
- /etc/paths
- ~/.bash_profile
- ~/.bash_login
- ~/.profile
- ~/.bashrc
解决
在 ~/.zshrc 文件中添加如下代码:
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi