Maven: install on mac. Tutorial for brew and the official method.

You received your new Apple shiny machine and you don't remember how to install Maven?

In the video we describe how to install Maven using Homebrew. In the post you can find alternative methods.

Homebrew is de facto the package manager for macOS. If you cannot use brew you can look at the alternative installation procedures described in the post.

Here are the few steps required:

1. Install Homebrew if it is not present yet

Verify that brew is installed in your system.

marco@mac ~ % brew 
Example usage: 
  brew search TEXT|/REGEX/ 

If the command is not found go to and copy / paste the instruction found in your Terminal.

2. Install maven

In your macOS Terminal write:

brew maven

Maven will be installed by brew.

3. Verify your maven installation

When brew confirm the installation you can verify if maven is working correctly.

marco@Marcos-Mac-mini ~ % mvn -version 
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) 
Maven home: /opt/homebrew/Cellar/maven/3.8.4/libexec 
Java version: 17.0.1, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/17.0.1/libexec/openjdk.jdk/Contents/Home 

Alternative methods

If you can't or you don't want to use for the installation of Maven we describe here alternatives methods.

Official method

The official maven installation instructions are the following:

  1. Have a JDK installation on your system. Set the JAVA_HOME environment variable pointing to your JDK installation or have the java executable on your PATH.

  2. Extract the archive in any directory. The archive can be found here:

  3. unzip apache-maven-{version} or tar xzvf apache-maven-{version}-bin.tar.gz

  4. Add the bin directory of the created directory apache-maven-{version} to the PATH environment variable


If you are using SDKMan for your Java frameworks you can install maven simply with:

$ sdk install maven

You can find more examples about SDKMan in this blog Java Angular Setup

WebApp built by Marco using SpringBoot, Java 17, Mustache, Markdown and in Azure