mac的环境变量
a. /etc/profile
b. /etc/paths
c. ~/.bash_profile
d. ~/.bash_login
e. ~/.profile
f. ~/.bashrc
其中 a和b是系统级别 c,d,e按照从前往后的顺序读取 如果c文件存在,则后面的几个文件就会被忽略不读了 ~/.bashrc没有上述规则,bash shell打开的时候载入 建议在c中添加环境变量
修改 vim ~/.bash_profile
export MAVEN_HOME=/usr/local/apache-maven-3.6.0
export PATH=$PATH:$MAVEN_HOME
生效 source ~/.bash_profile
参考 mac下添加环境变量