Search code examples
maven

Maven command not found on mac sonoma


I am new to mac os. I am using zsh as terminal and I have this in my .zprofile

export M2_HOME="/Users/myUser/apache-maven-3.6.3"
PATH="${M2_HOME}/bin:${PATH}"
export PATH
eval "$(/opt/homebrew/bin/brew shellenv)"

I saved this file and then did mvn -version

but the command mvn could not be found. I have downloaded the apache zip file and extracted it in downloads folder and then moved the extracted folder to my myUser directory (it is inside)

I am running out of ideas, checked some stackoverflow posts but nothing helped me.


Solution

  • I had this same problem on Sonoma. I ended up running 'brew install maven' from where I wanted to run maven and that solved it. I'm assuming you also use brew since I see it in your output but if not, try whatever command line installer you have or get Homebrew first.