In this Post we will see How to install Maven on Mac OS. Maven is build tool primary for Java projects.
Prerequisites:
Maven is written in Java. Therefore, we need to have Java JDK installed on Mac OS. Java can be install from Oracle’s download website.
If you have to View How to install Java JDK on Mac OS X ( with JAVA_HOME ) the follow the Video instruction in https://youtu.be/y6szNJ4rMZ0
Maven Installation Steps:
Step 1 Download the Apache Maven bin.tar.gz file from http://maven.apache.org/download.cgi
.
Extract/unzip the distribution archive file into /Applications/apache-maven-3.4.5
by the following command.
$ tar -xvf apache-maven-3.4.5-bin.tar.gz -C /Applications/
Step 2 Add the M2_HOME environment variable. To edit your ~/.bash_profile, run the following command to open it in text editor.
open -e ~/.bash_profile
Step 3 Add the following exports to your ~/.bash_profile and save it.
export M2_HOME=/Applications/apache-maven-3.4.5 export PATH=$PATH:$M2_HOME/bin
Step 4 Use source command on ~/.bash_profile which is used to load any functions file into the current shell script or a command prompt.
source ~/.bash_profile
Step 5
Run the following command to verify maven version
mvn -version
If your Mac OS system displays information on the Apache Maven version installed, this means Maven is successfully installed on you Mac.
Video Instructions – How to install Maven on Mac
Didn’t work for me even though I followed every step
-bash: mvn: command not found