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下添加環境變量