user6572009
user6572009

Reputation:

install maven on mac

i'm trying to install maven on my mac first i downloaded apache-maven-3.3.9 and then i entered this code on my bash:

export M2_HOME=$(/usr/local/apache-maven/apache-maven-3.3.9)

and

export PATH=${PATH}:/Users/sabrine/ant/bin:$JAVA_HOME/bin:$ANT_HOME/bin:$M2_HOME/bin:

but it doesn't work i got(i tried with mvn -v)

-bash: mvn: command not found

where is the problem? what should i do?

Upvotes: 1

Views: 3678

Answers (3)

Aditya Aggarwal
Aditya Aggarwal

Reputation: 680

You can install maven on mac using this command.

brew install maven

Upvotes: 0

SRajpoot
SRajpoot

Reputation: 57

Please follow below steps on terminal

Create bash profile (will be created under home folder and will be hidden file)

$ touch .bash_profile

Edit bash profile in editor and put next 2 commands in file, save file.

 export M2_HOME=/Users/srajp/apache-maven-3.5.3

 export PATH=$PATH:/Users/srajp/apache-maven-3.5.3/bin

Then check Maven version

$ mvn --version

If needed please see detailed steps on my blog on How to install Maven on MAC OS?

Upvotes: 3

Krzysztof Krasoń
Krzysztof Krasoń

Reputation: 27476

Don't add $( ) around the paths, just use:

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9

Followed by yours:

export PATH=${PATH}:/Users/sabrine/ant/bin:$JAVA_HOME/bin:$ANT_HOME/bin:$M2_HOME/bin:

The above assumes that your maven installation is in /usr/local/apache-maven/apache-maven-3.3.9, and ls -ld /usr/local/apache-maven/apache-maven-3.3.9 gives non-error output.

Upvotes: 0

Related Questions