How do I install Gradle in OS X?

In this post we will learn how to install Gradle in OS X. The following steps will guide our installation process to make Gradle available in our OS X machine. But before we start let’s take a look at the definition from wikipedia about Gradle.

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache Maven of declaring the project configuration.

Gradle installation steps:

Download Gradle

To download visit Gradle download page. Download the complete distribution which includes binaries, sources and offline documentation. When I write this post the latest release of Gradle is version 2.10 (gradle-2.10-all.zip).

Upacking Gradle and Configure Environment Variables

  • Open Terminal.app.
  • Create a new directory sudo mkdir /usr/local/gradle.
  • Extract the downloaded Gradle distribution archive by executing sudo unzip gradle-2.10-all.zip -d /usr/local/gradle.
  • Edit .bash_profile in your home directory to add GRADLE_HOME variable with the following line export GRADLE_HOME=/usr/local/gradle/gradle-2.10
  • Also update the PATH variable to include $GRADLE_HOME/bin. If you don’t already have the PATH variable add the following line export PATH=$GRADLE_HOME/bin:$PATH
  • Run source ~/.bash_profile to executes the update version of .bash_profile. Or you can open a new Terminal.app to make this changes active.

Running the Installation

To test Gradle installation open the Terminal.app and execute gradle -v command. If your installation was correct you will see something like the following output:

$ gradle -v

------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time:   2015-12-21 21:15:04 UTC
Build number: none
Revision:     276bdcded730f53aa8c11b479986aafa58e124a6

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_20 (Oracle Corporation 25.20-b23)
OS:           Mac OS X 10.11.2 x86_64
Wayan Saryada

Wayan Saryada

A programmer, runner, recreational diver, currently living in the island of Bali, Indonesia. Mostly programming in Java, creating web based application with Spring Framework, JPA, etc. If you need help on Java programming you can hire me on Fiverr.
Wayan Saryada

Leave a Reply