I\'ve installed gradle
on MAC using terminal.
brew install gradle
Gradle has been installed successfully.
gradle -v
--
I've gradle installed When using homebrew, below one failed with me, and kept telling undefined:
/usr/local/Cellar/gradle/<version>
The below symlink worked perfectly, and solved my issue:
/usr/local/opt/gradle/libexec
You can retrieve the path for GRADLE_HOME
automatically using the following snippet in your .bashrc
or .zshrc
:
export GRADLE_HOME=$(brew info gradle | grep /usr/local/Cellar/gradle | awk '{print $1}')
This is handy when the path to Gradle's home changes, when Gradle is updated.
"brew info gradle" command not always give the installed path
br*ew info gradle
gradle: stable 5.6.3
Open-source build automation tool based on the Groovy and Kotlin DSL
https://www.gradle.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gradle.rb
==> Requirements
Required: java >= 1.8 ✔
==> Analytics
install: 29,106 (30 days), 144,607 (90 days), 611,211 (365 days)
install_on_request: 28,237 (30 days), 137,584 (90 days), 577,691 (365 days)
build_error: 0 (30 days)*
My point isn't enough for commenting on flic's answer in the previous post. If it happens to be in MacOS, the asterisk should be escaped as:
brew info gradle | sed -nE 's#^(/usr/local/Cellar/gradle/[^ ]+).+\*#\1#p'
or there will be sed: 1: "s#^(/usr/local/Cellar/g ...
: RE error: repetition-operator operand invalid" error reported.
On Mojave, Gradle v6.6, I appended libexec after Gradle version for IntelliJ to work.
/usr/local/Cellar/gradle/5.4/libexec
On Mojave (v10.14), Gradle v5.4, I had to append libexec
after Gradle version for IntelliJ to work.
/usr/local/Cellar/gradle/5.4/libexec