Installing Maven on a Mac

Current Mac OS X Snow Leopard comes with Maven 2.2.1 installed. Let’s go ahead and update it to the latest version 3.0.2.

First, download it from Apache Maven site.

Unzip the downloaded file into the desired folder. You can put it in /usr/local. However in my case I prefer /app folder.

Create a simple alias:

air:app dmitry$ ln -s apache-maven-3.0.2/ maven
air:app dmitry$ ls
apache-maven-3.0.2	eclipse			maven

We are almost done. Update your .profile to setup PATH

export M2_HOME=/apps/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

Source your .profile file and we are done. Let’s make sure of that:

air:~ dmitry$ mvn -version
Apache Maven 3.0.2 (r1056850; 2011-01-08 19:58:10-0500)
Java version: 1.6.0_22, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.6.6", arch: "x86_64", family: "mac"