Audvik Labs

Installing Maven on Mac OS

How to install Maven on Mac OS

Maven requires Java to execute. So we will have to first install Java and then maven into our Mac OS.

1. Installing Java on Mac

We will install OpenJDK in our Mac OS. It’s free and you don’t have to worry about licensing that comes with Oracle JDK build.

1.1 Downloading Java for Mac OS

Go to the latest JDK GA release page and download the tar file for Mac OS.

Then extract it to the directory of your choice.

For instance you can prefer to keep your JDK setup at “/Library/Java/JavaVirtualMachines/” directory.

$tar -xvf openjdk-13.0.1_osx-x64_bin.tar.gz
$sudo mv jdk-13.0.1.jdk/Library/Java/JavaVirtualMachines/

Now Open .bash_profile and add the following entries at the end of it.


Now, Download Maven for Mac OS by going to the Maven Download site.

Download the “Binary tar.gz archive” file

After downloading, extract it using the below command.

$tar -xvf apache-maven-3.6.3-bin.tar.gz

The binaries will be extracted in the “apache-maven-3.6.3” directory. You can keep them anywhere.

The next step is to set up the environment variables –  M2_HOME and Path.

We have to add the Maven bin directory to the Path variable.

Finally, run the “mvn -version” command to check if Maven is installed successfully.

Leave a comment

Your email address will not be published. Required fields are marked *