Blake Caldwell: /dev/blog
Not a Java Developer

Java: Maven Environment Variables on OS X

Mac OS X comes with Apache Maven preinstalled. However, you’re still going to need to set some environment variables to get up and running.

Verify that maven installed in /usr/share/maven:

ls /usr/share/maven

Add the following line to your ~/.profile

# Set the M2_HOME environment variable
export M2_HOME=/usr/share/maven

# Put maven on your path
export PATH=$M2_HOME/bin:$PATH

This won’t take effect until you either reboot or open a new terminal window. You can reload the file in the current terminal window with the following command:

source ~/.profile