下载maven

http://maven.apache.org/download.cgi

解压

解压到 /usr/local 重命名为maven

新建(如无).bash_profile

编辑内容:

1
2
3
4
5
6
7
8
9
10
11
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
M3_HOME=/usr/local/maven3
PATH=$M3_HOME/bin:$PATH
export JAVA_HOME
export M3_HOME
export PATH

测试

mvn -version

如未生效

source .bash_profile 使之生效