Install Gradle

This post will guide through steps to Gradle

Pavan Kulkarni

2 minute read

Install Gradle on Mac system easily and quickly. This post will give a complete walk through of installing Gradle using brew and manual installation

Install gradle with brew

  1. Installing brew on Mac is simple process. You need to have brew installed on your system as a pre-requisite. You can install brew from here
  2. Install gradle as

    brew update
    brew install gradle
    
  3. Verfiy gradle installation

    Pavans-MacBook-Pro:~ pavanpkulkarni$ gradle --version
    
    ------------------------------------------------------------
    Gradle 4.6
    ------------------------------------------------------------
    
    Build time:   2018-02-28 13:36:36 UTC
    Revision:     8fa6ce7945b640e6168488e4417f9bb96e4ab46c
    
    Groovy:       2.4.12
    Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
    JVM:          1.8.0_152 (Oracle Corporation 25.152-b16)
    OS:           Mac OS X 10.13.3 x86_64
    

Install gradle with SDKMAN.

  1. Install SDKMAN. To do this, open Terminal and run

    $ curl -s "https://get.sdkman.io" | bash
    
  2. Run the below command to add SDKMAN path to ~/.bash_profile.

    source $HOME/.sdkman/bin/sdkman-init.sh
    

    NOTE: Check ~/.bash_profile file to verfiy if SDKMAN is added. If you do not see the entry for SDKMAN at the end of the file, add these line to ~/.bash_profile manually.

        ```
    
        #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
        export SDKMAN_DIR="/Users/pavanpkulkarni/.sdkman"
        [[ -s "/Users/pavanpkulkarni/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/pavanpkulkarni/.sdkman/bin/sdkman-init.sh"
        ``` 
    
  3. Run source ~/bash_profile to reflect the changes. Open a new tab in terminal. Verify installation by running

    Pavans-MacBook-Pro:~ pavanpkulkarni$ sdk version
    
    SDKMAN 5.6.2+294
    
  4. To install your desired version of gradle, run

    Pavans-MacBook-Pro:~ pavanpkulkarni$ sdk install gradle 4.6
    
  5. Verify your installation by running

    Pavans-MacBook-Pro:~ pavanpkulkarni$ gradle --version
    

References:

  1. https://gradle.org/install/
  2. https://gradle.org/
  3. http://sdkman.io/install.html