1

I currently have gradle 1.10

I have tried:

brew versions gradle 

and then:

git checkout 8ef0672 /usr/local/Library/Formula/gradle.rb

because I saw:

1.12     git checkout 8ef0672 /usr/local/Library/Formula/gradle.rb

but got this error:

fatal: Not a git repository (or any of the parent directories): .git

how can I install specific gradle version using homebrew?

JJD
  • 50,076
  • 60
  • 203
  • 339
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • `brew install gradle` doesn't install the latest version for you? – Beggarman Jul 30 '14 at 17:42
  • 1
    `brew update && brew upgrade gradle`, this is not a valid SO question (should be asked on SU) – Mike Szyndel Jul 30 '14 at 22:20
  • 1
    Instead of installing a specific Gradle version on your system, I'd recommend using the [Gradle Wrapper](http://www.gradle.org/docs/current/userguide/gradle_wrapper.html) exclusively for every project individually. – Benjamin Muschko Jul 30 '14 at 22:52

3 Answers3

7

Do something like this:

cd $(brew --prefix)
brew versions gradle
## copy and run the git checkout for your desired gradle version
brew unlink gradle
brew install gradle

That worked for me. I am on a Mac OSX though.

stevebot
  • 23,275
  • 29
  • 119
  • 181
2

First the problem with your git request, is you are trying to pull a non git repository. An example of what a git repo looks like is

https://github.com/gradle/gradle.git

Also you you might be struggling with the wrong version being listed in your ruby dependencies file.

However to install another version of gradle (assuming you have the most recent one, if you don't I can help too):

  1. Check to see if you have the older version of gradle with: $ brew info gradle
  2. If the version you want exists, switch versions $ brew switch gradle SOME_VERSION where you replace SOME_VERSION with the version number you want (and was shown to be installed).

In the interest of not being redundant, if you don't have the version desired installed refer to this other post: Homebrew install specific version of formula?

Community
  • 1
  • 1
Jono
  • 3,393
  • 6
  • 33
  • 48
0

To install different versions of the software package with homebew,

brew tap homebrew/versions 

Search for the desired package:

brew search gradle 

The results :

gradle                              homebrew/versions/gradle18          homebrew/versions/gradle24        
homebrew/versions/gradle110         homebrew/versions/gradle20          homebrew/versions/gradle26        
homebrew/versions/gradle112         homebrew/versions/gradle21          homebrew/versions/gradle27        
homebrew/versions/gradle16          homebrew/versions/gradle221         homebrew/versions/gradle28        
Caskroom/cask/qlgradle

Now chose your desired version:

brew install homebrew/versions/gradle112
Renien
  • 551
  • 4
  • 19
  • 4
    This no longer works: `Error: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated.` – Ricky Nelson Apr 23 '19 at 14:25