In this short tutorial, you will learn a couple of ways you can install maven on your Mac OS computer.
- Install maven with Homebrew,
- Install maven by downloading Maven archive.
Install Maven with Homebrew
Perhaps the easiest way to install Maven on your Mac OS machine is to use Homebrew. Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS operating system and Linux.
If for some reason you do not have Homebrew installed on your Mac machine, you can quickly install Homebrew by running the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
To install Maven with Homebrew, open terminal window on your Mac OS and type the following command:
brew install maven
If all is good you should maven downloading to your computer:
==> Downloading https://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz ==> Best Mirror http://apache.mirror.globo.tech/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz ######################################################################## 100.0% 🍺 /usr/local/Cellar/maven/3.3.9: 94 files, 9.6M, built in 7 seconds
Once the download is complete, verify the installation by running the following command:
mvn -v
This will print the current version of maven install on your computer, together with some additional details. For example:
mvn -v Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00) Maven home: /usr/local/Cellar/maven/3.3.9/libexec Java version: 1.8.0_121, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"
Maven is now installed on your computer!
Install Maven From a Downloaded Archive
To install Maven from an archive, you will need to first download Maven archive. Once you have Maven archive downloaded, extract it to a folder which you want to be Maven Home.
Once you have extracted Maven from a downloaded archive to a folder on your computer, add Maven to an Environment PATH.
export PATH=$PATH:<MAVEN HOME FOLDER HERE>/bin
Once you have added Maven /bin folder to an Environment Path, verify Maven installation by running the following command:
mvn -v
If all is good, you should see Maven version printed together with some additional information. You should now have Maven installed and working on your computer.
I hope this tutorial was helpful to you. If you are interested to learn more about Maven, have a look at the below list of online video lessons. One of them might greatly speed up your learning progress.