参考链接: https://blog.csdn.net/waneto2008/article/details/52486433
一、MacOS加载bash shell 环境变量的加载顺序
mac 一般使用bash作为默认shell,Mac系统的环境变量,加载顺序为:
1、系统级别的
/etc/profile
/etc/bashrc
/etc/paths
2、用户级别的
~/.bash_profile (mac用的)
~/.bash_login
~/.profile
~/.bashrc (这个linux用的)
二、各加载方式的分析和修改方法
1、/etc/profile
(1)文件构成
执行vi /etc/profile之后呈现:
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if [ "${BASH-no}" !&#