Vu Long Tran

Installing Apache Maven on Mac OS X

Written by Vu Long Tran | Jul 29, 2021 3:46:41 AM

To install Apache Maven on your Mac, that is, on a Mac OS X operating system we can download and install the latest version of Apache Maven onto your Mac.

Here is a step by step guide:

Step 1 - Download Apache Maven

Step 2 - Extract the Apache Maven file

Step 3 - Check that Apache Maven is set up

Step 1 - Download Apache Maven

Download the latest version from the Apache Maven site.

Select the "Binary zip archive" file type.

For example, apache-maven-3.8.1-bin.zip. 

Step 2 - Extract the Apache Maven file

Extract the Apache Maven bin file 

Once you download it, you can extract the bin file (i.e., unzip apache-maven-3.8.1-bin.zip file). Let's assume it has been downloaded to your Downloads folder on your Mac.

We can extract the bin file here, and then move it to our preferred location. 

In Terminal, let's change our view to our "Downloads" folder.

cd download

Check that our Apache Maven has been downloaded and then unzip it.

ls download

Check that our Apache Maven is unzipped properly.

ls /opt/apache-maven

Add Apache Maven to our Environment Path

sudo mv apache-maven-3.8.1 /opt/apache-maven

Step 3 - Check that Apache Maven is set up

As we have moved the core Apache Maven files to our environment path, we can check now that Apache Maven has been set up correctly. Run the following command to check: 

mvn -version