Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Homebrew get list of formulas in a tap

Tags:

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.

like image 429
user2554585 Avatar asked Aug 15 '14 21:08

user2554585


People also ask

How do I check my brew taps?

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.

What does the tap command do?

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.

Where are Homebrew taps stored?

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 .

How do I find Homebrew casks?

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.


2 Answers

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[])' 
like image 196
forivall Avatar answered Sep 27 '22 19:09

forivall


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 
like image 45
Tim Smith Avatar answered Sep 27 '22 17:09

Tim Smith