Home > Build-Management > Install Maven under Mac OS X

Install Maven under Mac OS X

Maven is a Java tool, so you must have Java installed in order to proceed. More precisely, you need a Java Development Kit (JDK), the Java Runtime Environment (JRE) is not sufficient.

  • Download latest stable version here.
  • Extract the distribution archive, i.e. apache-maven-3.0.3-bin.zip to the directory you wish to install Maven 3.0.3. The subdirectory apache-maven-3.0.3 will be created from the archive. These instructions assume you chose /usr/local/apache-maven.
    sudo mkdir /usr/local/apache-maven/
    sudo unzip /Users/cduu/Downloads/apache-maven-3.0.3-bin.zip -d /usr/local/apache-maven/
  • In a command terminal, add the M2_HOME environment variable, e.g.
    export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.3
  • Add the M2 environment variable, e.g.
    export M2=$M2_HOME/bin
  • Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g.
    export MAVEN_OPTS="-Xms256m -Xmx512m"

    This environment variable can be used to supply extra options to Maven.

  • Add M2 environment variable to your path, e.g.
    export PATH=$PATH:$M2
  • Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/Library/Java/Home/ and that $JAVA_HOME/bin is in your PATH environment variable.
  • Run mvn -v to verify that it is correctly installed.
Categories: Build-Management
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s