How do you set up Gradle properly and create a new Gradle project for IntelliJ IDEA?

Lets' say you unpacked gradle to d:\tools\gradle.

To add its bin directory it to the PATH in a console window, execute the following command:

set PATH=d:\tools\gradle\bin;%PATH%

The above prepends the bin path to the current value of the PATH environment variable. This will only change the path for this specific command window.

If you want to add it to the PATH globally, then go to your control panel and choose System, then Advanced parameters (it might be something a little bit different: I'm translating from my French version of Windows). Then in the Advanced system parameters tab, click the button Environment variables.... Find the Path environment variable in the list, and add the directory, separated from the others using a semicolon (;).

Note: you can also define a new environment variable called GRADLE_HOME:

set GRADLE_HOME=d:\tools\gradle

or globally, as explained above, and reference it inside the PATH variable:

set PATH=%GRADLE_HOME%\bin;%PATH%

Just intall homebrew.

Then you can just open the terminal and install easy like:

brew install gradle

Done! It's installed!

For test just type in your terminal:

gradle -v

And you'll have something like this:

------------------------------------------------------------
Gradle 2.7
------------------------------------------------------------

Build time:   2015-09-14 07:26:16 UTC
Build number: none
Revision:     xxxxxxxxxxxxxxxxxxxxxxxxxx

Groovy:       2.3.10
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_60 (Oracle Corporation 25.60-b23)
OS:           Mac OS X 10.11.1 x86_64

Then, open your IntelliJ and create a new gradle project as normal, just setting the gradle's path when necessary (normally in /usr/local/Cellar when installed with homebrew or /opt when installed other ways).

Good luck!