用户的环境变量一般配置在/users/username/.bash_profile文件中,因此修改.bash_profile 文件即可:
假设username为xxxx
PATH=/usr/xxxx/sbin:/usr/xxxx/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/Applications/java_tools/:/Applications/java_tools/taobao-tomcat-7.0.68/bin
MAVEN_HOME=/Applications/java_tools/apache-maven-3.1.1
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
PATH=$MAVEN_HOME/bin:$PATH
PATH=$JAVA_HOME/bin:$PATH
export MAVEN_HOME
export JAVA_HOME
export PATH="/usr/local/opt/openssl/bin:$PATH"
修改完后保存改文件,然后回到控制台,执行source ~/.bash_profile 新的配置即可生效