Maven not found in Mac OSX mavericks

Sahil Mahajan picture Sahil Mahajan · Oct 30, 2013 · Viewed 107.3k times · Source

After upgrading my Mac OSX 10.8 to 10.9, Maven not found in the /usr/share path but its installed in 10.8.

when I try this command:

$ maven -version

got this result

-bash: mvn: command not found

but it worked fine on 10.8? Any idea?

Answer

pkyeck picture pkyeck · Nov 22, 2013

if you don't want to install homebrew (or any other package manager) just for installing maven, you can grab the binary from their site:

http://maven.apache.org/download.cgi

extract the content to a folder (e.g. /Applications/apache-maven-3.1.1) with

$ tar -xvf apache-maven-3.1.1-bin.tar.gz

and finally adjust your ~/.bash_profile with any texteditor you like to include

export M2_HOME=/Applications/apache-maven-3.1.1
export PATH=$PATH:$M2_HOME/bin

restart the terminal and test it with

$ mvn -version

Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: /Applications/apache-maven-3.1.1
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: de_DE, platform encoding: MacRoman
OS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"