Installing previous versions of a formula with brew extract
Still not sure this is the best way to create a new tap. I created homebrew-repo
on my GitHub, then added the tap, then initialized the tap using tap-new
.
$ TAP=rjollos/homebrew-repo
$ TAP_PATH=$(brew --repository)/Library/Taps/$TAP
$ brew tap $TAP
==> Tapping rjollos/repo
Cloning into '/usr/local/Homebrew/Library/Taps/rjollos/homebrew-repo'...
warning: You appear to have cloned an empty repository.
Tapped (16 files, 22.2KB).
$ brew tap-new $TAP
==> Created rjollos/repo
/usr/local/Homebrew/Library/Taps/rjollos/homebrew-repo
$ cd $TAP_PATH
$ git add .
$ git commit -m "Initialized with template files"
[master (root-commit) c7c4bed] Initialized with template files
2 files changed, 29 insertions(+)
create mode 100644 .github/workflows/main.yml
create mode 100644 README.md
$ git remote -v
origin https://github.com/rjollos/homebrew-repo (fetch)
origin https://github.com/rjollos/homebrew-repo (push)
Extract the versioned formula:
$ brew extract --version 1.13.0 subversion $TAP
==> Searching repository history
==> Writing formula for subversion from revision dab5452 to:
/usr/local/Homebrew/Library/Taps/rjollos/homebrew-repo/Formula/[email protected]
Add the formula:
$ cd $TAP_PATH
$ git add Formula
$ git commit -m "Add Subversion 1.13 formula"
1 file changed, 203 insertions(+)
create mode 100644 Formula/[email protected]
$ git push
Enumerating objects: 10, done.
Counting objects: 100% (10/10), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (10/10), 3.99 KiB | 2.00 MiB/s, done.
Total 10 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/rjollos/homebrew-repo
* [new branch] master -> master
Taps can be created locally without actual github repository. Here is general example:
TAP=... # <org>/<repo>, for example "my-org/homebrew-old"
MODULE=... # name of module you want to install, e.g. "hugo"
VERS=... # version of $MODULE you want to install, e.g., "0.80.0"
brew tap-new $TAP
brew extract --version $VERS $MODULE $TAP
brew install $TAP/$MODULE@$VERS