Along with Maven, Gradle is also a tool that helps us build source code easily. Gradle’s strength is that it allows us to add custom code written in Groovy to perform operations that the default plugins do not support. In this tutorial, I will show you how to install Gradle to use Gradle with the command line on macOS!
First, you need to go to Gradle’s Release page https://gradle.org/releases/ to download its latest version. At the time of writing this tutorial, the latest Gradle is 7.2. Please download the binary-only version.
Once the download is complete, unzip the downloaded file:
To be able to use Gradle with the command line in any directory on your machine, you need to configure the environment variable to point to Gradle’s bin directory. You can modify the .bash_profile file in the user directory, adding the path to Gradle’s bin directory in the $PATH variable as follows:
For this change to take effect, execute the following command in the user directory:
To check the results, you can enter the following command: