I’m assuming JDK or JRE is installed and configured but currently missing Maven. To setup first download the binary tar.gz archive from https://maven.apache.org/download.cgi
Next deflate it to your preferred location. I like to put mine at ~/Documents/
mv apache-maven-3.8.7-bin.tar.gz ~/Documents
cd ~/Documents
tar -xzvf apache-maven-3.8.7-bin.tar.gz
Now setup your PATH by editing .zprofile
at home folder
cd
vim .zprofile
Copy the below into your .zprofile
and amend your path accordingly.
export M2_HOME='/Users/kevin/Documents/apache-maven-3.8.7'
PATH="${M2_HOME}/bin:${PATH}"
export PATH
Close your terminal and reopen a new one. The changes should take effect already. Test your Maven by checking for its version.