Maven not found in Mac OSX mavericks
Maven is not installed any more by default on Mac OS X 10.9. You need to install it yourself, for example using Homebrew.
The command to install Maven using Homebrew is
brew install maven
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"
brew install maven
Please ensure that you've installed the latest Xcode and Command Line tools.
xcode-select --install
- Download Maven from here.
- Extract the tar.gz you just downloaded to the location you want (ex:/Users/admin/Maven).
- Open the Terminal.
- Type "
cd
" to go to your home folder. - Type "
touch .bash_profile
". - Type "
open -e .bash_profile
" to open .bash_profile in TextEdit. - Type the following in the TextEditor
alias mvn='/[Your file location]/apache-maven-x.x.x/bin/mvn'
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdkx.x.x_xx.jdk/Contents/Home/
(Make sure there are no speech marks or apostrophe's) 8. Make sure you fill the required data (ex your file location and version number).
- Save your changes
- Type "
. .bash_profile
" to reload .bash_profile and update any functions you add. (*make sure you separate the dots with a single space). - Type
mvn -version
If successful you should see the following:
Apache Maven 3.1.1
Maven home: /Users/admin/Maven/apache-maven-3.1.1
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.1", arch: "x86_64", family: "mac"