Installing Apache Maven on Mac

While the installation guide on Apache is helpful, I decided to document the exact steps (some are not covered on the Apache site) I took to get Apache Maven installed in my machine.

  1. Add JAVA_HOME environment variable to .bash_profile

    export JAVA_HOME=$(/usr/libexec/java_home)
  2. Reload .bash_profile by running:

    . ~/.bash_profile
  3. Download the Apache Maven distribution archive from here.
  4. Add the bin directory to the PATH environment variable.
    In, .bashrc, add:

    export PATH=/path/to/apache/maven-3.3.9/bin:$PATH
  5. Reload .bashrc by running:

    . ~/bashrc
  6. Type the following the confirm Maven has been installed successfully:

    mvn -v