Forked from SQiShER/UpdateEnvironmentPlist.sh
Last active
September 18, 2015 14:42
-
-
Save cici/359057880d66204c2c41 to your computer and use it in GitHub Desktop.
Two simple commands to resolve problems with Maven installed via Homebrew
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defaults write ~/.MacOSX/environment.plist M2_HOME `brew --prefix maven`/libexec | |
| defaults write ~/.MacOSX/environment.plist M2 `brew --prefix maven`/libexec/bin |
Author
Author
I also did
export M2=brew --prefix maven/libexec/bin
export M2_HOME=brew --prefix maven/libexec
so that I could use maven in my open shell.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you install Maven via Homebrew, chances are that you run into this error, as soon as you try using it:
To fix it, you need to point the M2_HOME environment variable to the libexec directory within the maven installation directory (run brew --prefix maven to see the directory of the currently activated version). Setting the M2 variable isn't necessary, but might help, if the problem persists. The two commands above will automatically set the correct paths in your ~/.MacOSX/environment.plist file and should be run every time you update Maven via Homebrew. In order for the changes to take effect you have to log out and in again or restart your Mac.
Credit goes to digitalsanctum.com for figuring this out.