Welcome to the Gradle Tutorial series, in this article we will see how to install Gradle on a Mac running macOS,
Prerequisites:
- You should have Java JDK installed on your macOS. If not please install Java JDK 8 or above version before installing Gradle. You can check if Java is installed on your system by typing the following command in Terminal.
code2care@mac ~ % java -version openjdk version "11.0.9.1" 2020-11-04 LTS OpenJDK Runtime Environment Zulu11.43+1021-CA (build 11.0.9.1+1-LTS) OpenJDK 64-Bit Server VM Zulu11.43+1021-CA (build 11.0.9.1+1-LTS, mixed mode)
Note: I have open JDK installed on my system, you can choose to install Oracle or any other implementation.
- Optional: If you have brew package installed, the installation will would be really quick.
You can check if brew is installed or not on your Mac by trying out the below command,
code2care@mac ~ % brew --version
Homebrew >=2.5.0 (shallow or no git repository)
Homebrew/homebrew-core (no Git repository)
Gradle installation using Homebrew - Package Manager:
- Run the below brew command,
% brew install gradle
You might get below error if Xcode Command Line tool is not installed,
code2care@mac ~ % brew install gradle Error: No developer tools installed. Install the Command Line Tools: xcode-select --install
Run the command xcode-select --install to install Command Line Tool before installing gradle.
Once Xcode tool is installed retry the command: brew install gradle
Check if Gradle is installed using command gradle
code2care@mac ~ % gradle Welcome to Gradle 6.8.3! Here are the highlights of this release: - Faster Kotlin DSL script compilation - Vendor selection for Java toolchains - Convenient execution of tasks in composite builds - Consistent dependency resolution For more details see https://docs.gradle.org/6.8.3/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) > Task :help Welcome to Gradle 6.8.3. To run a build, run gradle <task> ... To see a list of available tasks, run gradle tasks To see a list of command-line options, run gradle --help To see more detail about a task, run gradle help --task <task> For troubleshooting, visit https://help.gradle.org ... BUILD SUCCESSFUL in 1s
Gradle installation manually:
- Download the latest version of Gradle binary: https://gradle.org/releases/: v6.8.3 is the latest release as of April 2021.
- unzip the downloaded package in /opt/gradle directory,
% mkdir /opt/gradle % unzip -d /opt/gradle gradle-6.8.3-bin.zip % ls /opt/gradle/gradle-6.8.3 LICENSE NOTICE bin getting-started.html init.d lib media
- Add Gradle installation to PATH variable,
% export PATH=$PATH:/opt/gradle/gradle-6.8.3/bin
Validate Gradle Installation
Now that you have installed Gradle either by brew or manually, you can check if the installation is successful by running the below command,
code2care@mac ~ % gradle -v
------------------------------------------------------------
Gradle 6.8.3
------------------------------------------------------------
Build time: 2021-02-22 16:13:28 UTC
Revision: 9e26b4a9ebb910eaa1b8da8ff8575e514bc61c78
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.10 (JetBrains s.r.o 11.0.10+9)
OS: Mac OS X 11.2.3 aarch64
- Run only a Single Unit Test using Gradle
- Run IntelliJ Java main method without Gradle build
- How to force re-download Gradle Dependencies
- How to Run Gradle Build Without Unit Test Cases
- Find installed Gradle version command
- Fix: Invalid Gradle JDK configuration found. Could not find the required JavaSDK
- Generate Project Dependency tree using Gradle Command
- Installing Gradle on macOS - Gradle Tutorial
- Gradle FAILURE: Build failed with an exception - Task not found in root project
- [Fix] ./gradlew: Permission denied
- Force Gradle to use specific Java JDK Version
- [fix] Deprecated gradle features were used in this build, making it incompatible with Gradle X.0
- Create a Gradle Java Project in VS Code
- Install Gradle VS Code for Java Projects
- Fix: Unsupported Java. Your build is currently configured to use Java 17.0.5 and Gradle 7.1.
- How to create Gradle Multi-Project in IntelliJ
- Fix: Spring Boot + IntelliJ + Gradle : Unsupported class file major version 64 Error
- Fix: Error: Could not find or load main class org.gradle.wrapper. GradleWrapperMain
- [fix] bash: gradlew: command not found
- [fix] Execution failed for task :core:compileJava - Could not find tools.jar
- Run Gradle Build without test cases
- How to add maven central repository in build.gradle
- Upgrade Gradle in Android Studio
- Task is ambiguous in root project gradle-examples. Candidates are: myTask1, myTask2
- Fix: Deprecated Gradle features were used in this build, making it incompatible with Gradle
- How to download Microsoft Visual Studio for M1/M2 Mac - MacOS
- Python Switch-Case Statement equivalent like Java Example - Python
- Android Studio Button onClickListener Example - Android-Studio
- Changed AD user display name showing old name in SharePoint - SharePoint
- Shortcut: How to delete a complete line in Nano Editor - Linux
- How to turn off Dark theme in Excel for Mac - Microsoft
- Show Hide SharePoint column in List Library form with the conditional formula - SharePoint
- Create SharePoint Site Collection using PowerShell New-SPSite - SharePoint