Do the following steps.
1. Download the zip file from apache maven website.(https://maven.apache.org/install.html)
2. Unzip the file. Example:-
unzip apache-maven-3.6.3-bin.zip
3. Make sure JAVA_HOME environment variable is set otherwise find out where it is installed by running below command
echo $(/usr/libexec/java_home)
it provides where java is installed. For example "/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home"
3. Open the ~/.bash_profile to add env variable.
export PATH=$PATH:/opt/apache-maven/bin
4. Save the bash_profile and run the file in command line
source ~./bash_profile
5. Check the changes in terminal by running echo $PATH
6. Run mvn --version to check the version of MVN