Sunday, March 27, 2022

How to Install Maven Manually on macOS

 1) Download the Maven


2) Extract tar: 
% tar -xvzf apache-maven-3.6.3-bin.tar.gz -C ~

3) Now, move the maven folder to this path /Users/{username}/

4) Need to create file is at this path /Users/{username}/

% cd && touch .zshenv && open .zshenv


Note :

  • On macOS 10.5 Catalina or later, the default shell is zsh (.zshenv).
  • For macOS 10.14 Mojave and before, the default Terminal shell is bash (.bash_profile).


5) Adde below lines of code in appropriate files:


export M2_HOME="/Users/{username}/apache-maven-3.8.5"

PATH="${M2_HOME}/bin:${PATH}"

export PATH


6) Source the ~/.zshenv to reflect the changes:


% source ~/.zshenv


7) Verify to check using mvn:


 % mvn -version                       

Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)

Maven home: /Users/{username}/apache-maven-3.8.5

Java version: 11.0.13, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.13.jdk/Contents/Home

Default locale: en_IN, platform encoding: UTF-8

OS name: "mac os x", version: "11.3", arch: "x86_64", family: "mac"

meena@MEENAs-MacBook-Pro ~ %