8

How do you install a specific version of a formulae, in Homebrew? - in my case; Grails 1.3.7

cllpse
  • 20,270
  • 35
  • 127
  • 168
  • Btw, Grails is distibuted as a Zip file, you can download any specific version and extract it anywhere in your system. Just it. And you can start using it, without any extra steps. It's also helpful when you want to have different versions. – Igor Artamonov Jun 07 '12 at 03:08
  • See also: http://stackoverflow.com/q/3987683/320399 – blong Jan 02 '13 at 21:51

2 Answers2

18

Update:

As pointed out by akst, homebrew has removed the versions command so this original method is no longer feasible.

If you really want to, you can still use brew log grails in place of brew versions grails to find the git SHA for an old version of Grails. The formula is now also in a deeper directory structure so I would recommend using find . -name grails.rb -execdir git checkout <YOUR SHA HERE> {} \;

However, I recommend using the fantastic SDKMAN! for managing versions of Grails (and other languages/frameworks!).

Old Answer:

Go to your brew base,

cd $(brew --prefix)

list the versions of grails,

brew versions grails

select the version you want (1.3.7)

git checkout 232acd0 $(brew --prefix)/Library/Formula/grails.rb

and now install like normal,

brew install grails

which will install version 1.3.7

doelleri
  • 17,308
  • 5
  • 57
  • 60
  • 1
    @akst thanks for pointing that out, I've updated the answer with a note and possible alternative. – doelleri Mar 13 '17 at 20:19
2

Rob Brinkman offers a bit more detail on this approach: http://blog.jdriven.com/2012/09/quick-tip-installing-a-specific-grails-version-on-os-x-using-homebrew/

Paraphrasing here:

brew unlink grails
brew versions grails
cd `brew --prefix` 
git checkout <some hash> <path to formula, i.e. /usr/local/Library/Formula/grails.rb>
brew install grails # install grails
git checkout -- /usr/local/Library/Formula/grails.rb # reset formula
blong
  • 2,700
  • 6
  • 35
  • 97