$ brew update
$ brew install maven
The response will be similar to
==> Using the sandbox
==> Downloading https://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.t
==> Best Mirror http://supergsego.com/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
######################################################################## 100.0%
🍺 /usr/local/Cellar/maven/3.5.0: 106 files, 9.8MB, built in 15 seconds
$ which mvn
/usr/local/bin/mvn
Note the location of "Maven home"
$ mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"
export M2_HOME=/usr/local/Cellar/maven/3.5.0/libexec
export M2=${M2_HOME}/bin
export PATH=${PATH}:${M2_HOME}/bin
Note: If you like the instructions here, please refer it on your posts/documentation. Contact me if there are corrections needed.