Can't run Apache Maven via command line on El Capitan
I assume your JAVA_HOME is not configured properly. This will result in an info and error output entering mvn -h or mvn -v.

To install Java 8 and Maven properly do the following:


Download and install the latest JDK 
Open Terminal and enter /usr/libexec/java_home. The result should be (as of August 2016):

/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home

Download and unzip Maven. Move the resulting folder to an appropriate folder (e.g. /opt/)
In Terminal enter nano .bash_profile. Add the lines

export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=/opt/apache-maven-3.3.9/bin:/...other_paths_already_in_your_profile..:$PATH


save the file to disk and quit nano with ctrlO and ctrlX
Source your modified profile with source .bash_profile or better restart Terminal.


If you have installed maven and/or java with MacPorts or homebrew, the approach is similar the paths to Java/Maven may differ though.