Introduction

When you start Intellij Idea the first time on your Mac and try to use Maven, it is very likely that you will encounter the following message, which just mean, that the path to Maven is not set.

No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.

I installed Maven by the use of brew and it is available from the console. If it was installed correctly you can just write mvn into your console and get an error message from Maven. The problem with Intellij Idea is, that it does not read the settings for the console and therefore it is unable to find the Maven Home directory.

Getting the path for your Maven installation

To retrieve the path for Maven it is enough to call mvn -v on the console.

kamwos-MacBook-Pro:~ kamwo$ mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /usr/local/Cellar/maven30/3.0.5/libexec
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.3", arch: "x86_64", family: "mac"

In my case the path is /usr/local/Cellar/maven30/3.0.5/libexec .

Set the path in Intellij Idea

Go to Perferences –> Maven –> Maven home directory

Insert the path into the field.

That’s all. It should work without restarting.