How to install Maven on Mac OS?

1. Check Java version. If Java is not installed then follow steps mentioned here.

java --version

java 13 2019-09-17
Java(TM) SE Runtime Environment (build 13+33)
Java HotSpot(TM) 64-Bit Server VM (build 13+33, mixed mode, sharing)

2. Download the latest maven binary version from http://maven.apache.org/download.cgi – apache-maven-3.6.3-bin.tar.gz

3. Extract the binary in user directory.

tar -xvf apache-maven-3.6.2-bin.tar.gz

$pwd
/Users/bijan/apache-maven-3.6.2

4. Set Maven command in environment variable.

Update ~/.bash_profile

vim ~/.bash_profile

~/.bash_profile

export M2_HOME=/Users/bijan/apache-maven-3.6.2
export PATH=$PATH:$M2_HOME/bin

5. Restart the terminal.

6. Test the maven version.

mvn --version 
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T20:36:16+05:30)
Maven home: /Users/bijan/apache-maven-3.6.2 
Java version: 13, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home Default locale: en_IN, platform encoding: UTF-8 OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"

 

Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!