How would I (through the command line) get the list of formulas in a tap from homebrew.
Running brew tap only list the tap but not the formulas that exist as part of that tap.
If such a command doesn't exist, how can I programmatically retrieve the list of formulas.
The brew tap command brew tap <user/repo> makes a clone of the repository at https://github.com/<user>/homebrew-<repo> into $(brew --repository)/Library/Taps . After that, brew will be able to work with those formulae as if they were in Homebrew's homebrew/core canonical repository.
The tap command allows Homebrew to tap into another repository of formulae. Once you've done this you've expanded your options of installable software. These additional Git repos (inside /usr/local/Homebrew/Library/Taps ) describe sets of package formulae that are available for installation. E.g.
The main repository at https://github.com/Homebrew/homebrew-core, often called homebrew/core , is always built-in. Your taps are Git repositories located at $(brew --repository)/Library/Taps .
You can use the --casks flag in brew search to "display all locally available casks". $ brew search -h Usage: brew search [options] [text|/text/] Perform a substring search of cask tokens and formula names for text. If text is surrounded with slashes, then it is interpreted as a regular expression.
The list of formulas in a tap is exposed in brew tap-info $TAP --json
.
From here, you can use a JSON command line parser to extract the list, such as jq
:
For example, to list all the formulas from homebrew/cask-fonts and kde-mac/kde:
brew tap-info homebrew/cask-fonts kde-mac/kde --json | jq -r '.[]|(.formula_names[],.cask_tokens[])'
After tapping:
TAP=telemachus/homebrew-desc # (or whatever; need the homebrew- prefix) TAP_PREFIX=$(brew --prefix)/Library/Taps ls $TAP_PREFIX/$TAP/Formula/*.rb || ls $TAP_PREFIX/$TAP/*.rb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With