How to define Gradle's home in IDEA?


I am trying to import a Gradle project into IntelliJ, and when I get to the Gradle Home textbox, it is not automatically populated, nor will typing in the path of Gradle Home result in a valid location - I have the GRADLE_USER_HOME environment variable set (to what I think is!) the correct path, and I have been able to successfully import this same project into Eclipse. Any suggestions?

1/2/2017 8:34:51 AM

Installed on a Mac via Homebrew, the path


is preferable to


since the former will survive version upgrades.


If you installed gradle with homebrew, then the path is:


Where X.X is the version of gradle (currently 2.1)


If you are using IntelliJ, just do the following.

  1. Close the project
  2. (re)Open the project
  3. you will see "Import gradle project" message on the right bottom. click.
  4. select "Use default gradle wrapper". not "Use local gradle distribution"

enter image description here

That's all.


This is what helped me solve the problem of not having Gradle home set for the IDEA when importing a Gradle project.

THREE OPTIONS -- (A) Default Wrapper (B) "gradle 'wrapper' task configuration" OR (C) "local gradle distribution" defined by jetbrains:

A. Default Wrapper (recommended)

If you are able, select this recommended option. If it is grayed out, see option C, which should then set your default for all subsequent projects.

B. Gradle 'Wrapper' Task Configuration

If you want IDEA to define your gradle version for you from your build script

  1. Set this option if you define your gradle build versions as a task within your actual gradle build.

Example below from jetbrains:

enter image description here

(useful if you do not want to share gradle builds between projects)

C. Local Gradle Distribution

1. Run the following command to get gradle location:

   brew info gradle (if gradle was installed with homebrew)

2. You are looking for something like this:


3. Next, append 'libexec' to the gradle location you just found:


This is because "libexec is to be used by other daemons and system utilities executed by other programs" (i.e. IDEA). Please see

4. Finally, put that new path in the Gradle home input box if IDEA prompts you.

enter image description here

  1. IDEA should now have allowed you to hit OK enter image description here

This is instruction for MAC only. I had the same problem. I solved it by configuring $GRADLE_HOME in .bash_profile. Here's how you do it:

  • Open .bash_profile (usually it's located in the user’s home directory).
  • Add the following lines to update $PATH variable: export GRADLE_HOME=/usr/local/opt/gradle/libexec export PATH=$GRADLE_HOME/bin:$PATH
  • Save it.
  • Apply your changes by running source .bash_profile

I wrote my own article with instruction in a case if somebody will encounter the same problem.