For keeping formulae of old software versions that I may want to revert back to!
For example, this repo! The repo must be named homebrew-tap
. This then need to be tapped - e.g.,
brew tap alexioannides/tap
Start by extract a formula - e.g.,
brew extract hashicorp/tap/terraform --version 1.9.1 alexioannides/tap
That will yield outout along the lines of,
==> Searching repository history
==> Writing formula for terraform at 1.8.0 from revision bca6603 to:
/opt/homebrew/Library/Taps/alexioannides/homebrew-tap/Formula/terraform@1.9.1.rb
Commit and push this to your remote repo - e.g.,
cd $(brew --repo alexioannides/tap)
git pull
git add -A && git commit -m "Add teraform@1.8.0"
git push origin main
You can now reinstall old version from you tap - e.g.,
brew install alexioannides/tap/terraform@1.8.0
If you having trouble extracting formulae from homebrew/core
, then run,
brew tap homebrew/core --force
As explained here.