Disclaimer:here is a complete answer taking, the last version of OS X (10.9 AKA Mavericks) to account. I am aware that everything I compiled in this answer are already present in the page, but have it clearly in one answer M Akes it a lot clearer.
First of all, with previous versions of OS X, Maven was installed by default. If Java is missing running [email protected]:~ $ Java in a terminal would prompt you for the Java installation.
With Mac OS X 10.9 (Mavericks), Maven isn't installed by default anymore. Different options is then possible:
-
Using Homebrew:
- [Email protected]:~$ Brew install maven would install MAVEN 3.1 which might cause issues
- [Email protected]:~$ Brew Install maven30 would install Maven 3.0 which should be Using MacPorts: (I did not test this)
-
- [Email protected]:~$ sudo port install Maven3 'll install Maven 3.0.5
- [Email protected]:~$ sudo port select–set maven Maven3 selects that version of Maven
- Installing by hand:
-
- Download Maven from its homepage
- Follow the installation instructions:
- Extract the distribution archive, i.e. apache-maven-3.1.1-bin.tar.gz to the directory of your wish to install Maven 3.1.1. These instructions assume you chose/usr/local/apache-maven. The subdirectory apache-maven-3.1.1 is created from the archive.
- In a command terminal, add the m2_home environment variable, e.g. export m2_home=/usr/local/apache-maven/apache-maven-3.1 .1.
- ADD the M2 environment variable, e.g. export m2= $M 2_home/bin.
- Optional:add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export maven_opts= "-xms256m-xmx512m". This environment variable can is used to supply extra options to Maven.
- ADD M2 environment variable to your path, e.g. export path= M 2 : PATH.
- Make sure this java_home is set to the location of the your JDK, e.g. export java_home= (/usR /l Ibex eC/J av a H ome?v1.8)aNd T haT Java_home/bin is in your PATH environment variable (although, might not being necessary with the latest MAC OS X versions and the Oracle JDK).
- Run mvn–version To verify the it is correctly installed.
Maven Install on Mac OS X