1

Suppose I have added a new tap to Brew using brew tap ....

I've tried looking into brew search, brew tap, and brew tap-info, but none of these subcommand present any suitable options.

How can I list all formulae available within that tap?

2
  • What have you tried, where have you looked?
    – nohillside
    Jun 4 '20 at 11:54
  • @nohillside - I've updated the question.
    – Shuzheng
    Jun 4 '20 at 12:00
5

From this Stack Overflow article:

List of formulae in a tap can be found by running brew tap-info $TAP --json

To turn this into a proper readable format we can run brew tap-info $TAP --json | jq -r '.[]|(.cask_tokens[])'

Example: To find all formulae in homebrew/cask-fonts we can do: brew tap-info homebrew/cask-fonts --json | jq -r '.[]|(.cask_tokens[])'

Break down of the command:

  1. brew tap-info homebrew/cask-fonts --json lists JSON info of the taps and some other stuff (output)
  2. jq -r '.[] removes the outside square bracket (output)
  3. |(.cask_tokens[])' gets the JSON value of the key cask_tokens

TL;DR: Running brew tap-info <tap-here> --json | jq -r '.[]|(.cask_tokens[])' will give you the formulae from that tap.

Note If this fails to list all try running brew tap-info <tap-here> --json | jq -r '.[]|(.formula_names[],.cask_tokens[])'

2
  • Why is .formula_names[] necessary? May a tap contain both formulae and casks?
    – Shuzheng
    Jun 4 '20 at 12:34
  • @Shuzheng Hmm thats interesting. For me this change of removing .formula_names[] made no difference to the output. From this paste we can see that there is a field with the key "formula_names". I am not sure if it is required to run with .formula_names[], but since the field is there in the JSON output I'm leaving it there for now.
    – Roxiun
    Jun 4 '20 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .