This article will show you how to configure apache maven in your macOS
Locate your maven install directory
eg. Suppose your maven install location as below:
/Users/yourname/Development/apache-maven-3.9.3
Create or Update .bash_profile file
Create a .bash_profile in root folder if you don’t have one, if there’s one, update the file, add below content at the end of the file.
export M2_HOME="/Users/yourname/Development/apache-maven-3.9.3"
PATH="${M2_HOME}/bin:${PATH}"
export PATH
Save and close terminal app, relaunch terminal and run maven command to check version
mvn -v
If you still got something error message like : “zsh: command not found: mvn”, try to run below command to apply the change
source .bash_profile
After above command, you should be able to use mvn command via terminal app
Reference
https://www.digitalocean.com/community/tutorials/install-maven-mac-os