Here are the steps to download Maven on your apple MacBook and setup MAVEN_HOME
- Download the Maven binaries from https://maven.apache.org/download.cgi
- While downloading, select the apache-maven-3.8.6-bin.zip (Binary zip archive)
- Extract unzip apache-maven-3.8.6-bin.zip using the terminal (for this example I’ve downloaded and extracted it into Documents folder)
- On you user terminal path /Users/binarycipheruser (pwd to check your path on the terminal)
- Hit ls -al to see the list of files your user folder
- Open the file .zshenv using the command open ~/.zshenv (if the file is not available create one using touch .zshenv)
- Add the below lines to the file
- export M2_HOME=Documents/apache-maven-3.8.6/bin
- export PATH=$M2_HOME:$PATH
- Save the file and
- Close the terminal and reopen the terminal to check if we successfully set up the MAVEN_HOME
- Hit mvn –version command
- You should see below message
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /Users/binarycipheruser/Documents/apache-maven-3.8.6
Java version: 11.0.16, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.16.jdk/Contents/Home
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "12.5.1", arch: "aarch64", family: "mac"
Here is the screenshot of the file
Note: If you are setting up on the bash command line use the file ~/.bashprofile
Ref: https://maven.apache.org/install.html
[…] Make sure you already installed JAVA 11 and setup JAVA_HOME and also installed Maven and setup MAVEN_HOME environment […]
[…] Prerequisites: Make sure you already installed JAVA 11 on your local and setup JAVA_HOME […]
[…] Install Maven and set up M2_HOME […]