mvn
executable from your terminal window. – Sri Sankaran Jan 12 '12 at 2:47 If, as in my case, you are trying to downgrade from Maven 3 back to Maven 2, see this excellent blog: blog.frau-klein.org/2011/04/… – Jeff Jan 2 '14 at 15:46 Edgardo I think you should uncheck the checked answer if you can... – jcollum Sep 9 '16 at 19:23 | java
by itself and it'll prompt you to install it.mvn -version
and see some output like this:brew update
just beforebrew install maven30
since maven 3.1.1 seems to be buggy. – tadeuzagallo Oct 24 '13 at 14:11 18 brew install homebrew/versions/maven30
did for me. Thanks @TadeuZagallo !! – fmquaglia Nov 19 '13 at 0:12 11 No need to use brew install maven30
anymore as the most current version 3.2.1 is pretty fast and seems to not have the bugs that 3.1.1 had. – Michael Hogenson May 29 '14 at 19:01 | show more commentsyou@host:~ $ java
in a terminal will prompt you for the Java installation.you@host:~$ brew install maven
will install latest Maven (3.3.9 on 20/01/2017)you@host:~$ brew install maven30
will install Maven 3.0 if neededyou@host:~$ sudo port install maven
will install latest Maven (?)you@host:~$ sudo port install maven3
will Install Maven 3.0you@host:~$ sudo port select --set maven maven3
selects that version of Mavenapache-maven-3.3.9-bin.tar.gz
to the directory you wish to install Maven 3.3.9. The subdirectory apache-maven-3.3.9
will be created from the archive.export MAVEN_OPTS='-Xms256m -Xmx512m'
. This environment variable can be used to supply extra options to Maven.export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
and that $JAVA_HOME/bin
is in your PATH
environment variable (although that might not be necessary with the latest Mac OS X versions and the Oracle JDK).apache-maven-3.3.9/bin
to your $PATH
mvn --version
to verify that it is correctly installed.sudo port install maven3
installs Maven 3.0.5. – njudge Mar 7 '14 at 18:24 1 Thanks, I'll trust you on that one and edited my summary! – snooze92 Mar 9 '14 at 10:40 3 When installing by hand, rather than dig around trying to find JAVA_HOME
, consider using export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
(cf this answer). Also (at least on Mavericks and Yosemite with the Oracle JDK 1.8) you shouldn't need $JAVA_HOME/bin
in your path as everything's symlinked from /usr/bin
. – David Moles Jan 9 '15 at 21:55 You're right about the better way to define JAVA_HOME
! I didn't know about the symlinks but I edited my answer to include your remarks. Thanks – snooze92 Jan 12 '15 at 7:20 1 better to add the export
instructions to ~/.bash_profile
to make it available in all sessions, see this post for details – Miranda Jun 25 '15 at 15:22 | show more commentsbrew install maven30
– timomeinen Jun 30 '14 at 12:52 1 I just used brew install maven
and it installed 3.0.5. Here's what prints when I do mvn -version
: mvn -version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28-0800) Maven home: /usr/local/Cellar/maven/3.0.5/libexec Java version: 1.7.0_45, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: 'mac os x', version: '10.9.3', arch: 'x86_64', family: 'mac'
– Noni A. Jul 5 '14 at 7:04 | show more commentsport
command not found – Shajeel Afzal Jan 29 '16 at 11:55 @ShajeelAfzal do you have MacPorts installed? – Marc Smith Jan 29 '16 at 14:05 1 @ShajeelAfzal it IS mentioned. It's the first 3 words of my answer: 'If using MacPorts...' MacPorts is also linked in my answer. I'm not sure what else you're looking for. – Marc Smith Jan 29 '16 at 19:31 Sorry, i missed that. – Shajeel Afzal Jan 29 '16 at 22:03 | brew install maven30
didn't work for me. Was complaining about a missing FORMULA. But the following command did work. I've got maven-3.0.5 installed.brew install maven
is installing now. – Nacho L. Nov 9 '13 at 10:29 It says -bash: brew: command not found
– Shajeel Afzal Jan 29 '16 at 11:56 @ShajeelAfzal You need to install Homebrew. Can be done with the following command: /usr/bin/ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'
– edufinn Feb 2 '16 at 7:59 brew install homebrew/versions/maven32
works for me on Sierra – Tobi Feb 22 at 16:27 Now I would recommend to install latest Maven with brew install maven
. – edufinn Feb 28 at 15:41 | sudo ln -s /path_to_maven_folder/bin/mvn /usr/bin/mvn
ln: /usr/bin/mvn: Operation not permitted
response, i think i need to follow this: stackoverflow.com/a/32661637/1773155 to resolve the problem. – Shajeel Afzal Jan 29 '16 at 12:02 | xcode-select --install
to install the Command Line Tools.brew install maven
brew tap homebrew/versions
brew install maven2
/usr/local/bin
first:mkdir bak
mv m* bak/
brew uninstall maven2
(only when conflicted)brew install maven2
Recommend:osx - how to force Maven 3.1 to use right version of Java on Mac OS 8.10onment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) This is the output from mvn -version: Java version: 1.6.0_51, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Conte