I'm trying to install maven through the terminal by following these instructions.
So far I got this
export M2_HOME=/user/apple/apache-maven-3.0.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JAVA_HOME=/usr/java/jdk1.6.0_22
This is probably a stupid question where do you go to find this?
Open a TERMINAL window and check if you have it already installed.
Type:
And you should see:
If you don't have Maven installed already, then here is how to download and install maven, and configure environment variables on Mac OS X: http://bitbybitblog.com/install-maven-mac/
This command
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.This is for Mac OS X 10.9 aka Mavericks.
If you don't want to install Homebrew only for install Maven you could simply do this:
Download the binary Maven and extract the zip
Launch the Terminal and type this command:
sudo ln -s /path_to_maven_folder/bin/mvn /usr/bin/mvn
You can find more details on this post.
OS X prior to Mavericks (10.9) actually comes with Maven 3 built in.
If you're on OS X Lion, you won't have java installed by default. Just run
java
by itself and it'll prompt you to install it.Assuming qualifications are met, run
mvn -version
and see some output like this:This worked for me:
$ vim .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
$ source .bash_profile
credit: http://www.mkyong.com/java/maven-java_home-is-not-defined-correctly-on-mac-osx/
Just a brief addition; if you want to install a specific version on MacOS using Homebrew 1.5.2, you can install it the following way:
This will give you maven versions available in homebrew
[If you want to install maven 3.3.]