Search code examples
bashmacosmaven-3

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?


Solution

  • 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.