In this tutorial, I will guide you all how to install Apache Maven on your macOS.
First, please download the latest version of Apache Maven at https://maven.apache.org/download.cgi. On macOS or Linux, we will download the bin.tar.gz file and on Windows, it is the bin.zip file.
After the download is complete, unzip the download file:
Now, we will configure the environment variable to point to the Apache Maven bin directory. The purpose of doing this is that: we can use Apache Maven anywhere on our machine.
To do this, open the .bash_profile file located in the user directory. On my machine is /User/Khanh.
and edit the contents of the PATH variable pointing to the path to the Apache Maven bin directory, mine is as follows:
1 |
export PATH=/Volumes/Passport/softwares/apache-maven-3.9.7/bin:$PATH |
Now, you can save our changes in this file.
To make our changes effective immediately, let’s reload the .bash_profile file with the following command:
1 |
. .bash_profile |
To check the results, you can enter the following command:
1 |
mvn -v |
Result: