Step 1: Download Maven binaries from Maven Official Site.
Step 2: You can install Maven at any location but since it’s a one time process, I didn’t wanted it in my user directory. So I installed it in /usr/local directory. You might have to use sudo command to install in /usr/local directory if you are getting permission denied error.
$ cd /usr/local $ sudo mv /Users/abProgrammer/Downloads/apache-maven-3.3.3-bin.tar.gz ./ $ sudo tar -xvf apache-maven-3.3.3-bin.tar.gz
Step 3: Now open the bash profile file and add following lines into it. Usually profile file names are .bash_profile or .profile, use whichever you have in your system. If you don’t have profile file, you will have to create one with vi command.
$ cd $HOME $ vi .bash_profile #Add below lines in the profile export M2_HOME=/usr/local/apache-maven-3.3.3 export PATH=$PATH:$M2_HOME/bin export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home #save and quit $ source .bash_profile
That’s it, maven is installed on your latest Mac OS X and you can verify it by issuing below command.
$ mvn --version Apache Maven 3.3.3 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2015-06-16 05:51:28-0800) Maven home: /usr/local/apache-maven-3.3.3 Java version: 1.8.0_40, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"