Sunday, October 6, 2019

Install Maven in Mac OSX

to install maven in Mac OSX, the easiest way is to use Homebrew

OR using the following steps:

  • Download maven from https://maven.apache.org
  • unzip the apache maven zip file into a location when you fix /User/XXX/Desktop/dev/apache-maven-X.X.X
  • then you would need to add the maven folder into your user's MacOSX path using vi or other text editor tools
            shell> vi ~/.bash_profile

file content

export M2_HOME=/path/to/your/maven/folder .  (e.g: /User/XXX/Desktop/dev/apache-maven-X.X.X)
export PATH=$PATH:$M2_HOME/bin

  • save the file by press "ESC" button, then type this command -> ":wq!"
  • you would need to refresh the system PATH using following command
            shell> source ~/.bash_profile
  • after that, type shell> mvn --version