Is there a way to get a list of all formulas (packages) I can install using homebrew for Mac OS X?
8 Answers
Online
You can visit formulae.brew.sh.
From your Mac
If you just want the package names for all formulae:
brew search
The following command will list the info snippets for all existing Homebrew formulae:
brew info --all
Or browse the local Git repository—thanks to Mk12 for that:
find /usr/local/Homebrew/ -type d -name "Formula" -exec ls -1 {} \;
- 235,242
Apart from the things slhck mentioned, there's an online package browser available at formulae.brew.sh.
- 2,059
- 363
- 1
- 9
As of 3 April, 2021, use
brew info --all --json=v1
To list all formulae in JSON format. To additionally also list casks, use:
brew info --all --json=v2
Calling brew info --all without --json=vN throws an error.
- 11
You can list Homebrew formulae using the command
brew search
or browse on the Web using http://formulae.brew.sh/.
UPDATE: Searching for casks has been integrated into the above-mentioned methods.
- 2,059
Technically, the answer provided by @pengii23 above is correct, but as we know, JSON isn't very easy to understand. Moreover, that results in over 266,000 lines of output for 4546 packages, or more than 56 lines per package.
What we really want is just the package name, and the package description. The format might be something like this:
package -- description goes here
pack2 -- other description goes here
Now, if you have done a brew install gron, then I have a doozy of a command-line for you that will generate the type of output above:
$ brew info --json=v1 --all | gron | egrep '(.desc|.full_name) =' | \
grep -v 'runtime_dependencies' | sed 's/full_name/_name/' | \
gron -u | egrep -v '({|}|\[|\])' | \
sed -e 's/^.*"_name": //' -e 's/^.*"desc": //' | tr -d '\n' | \
sed -e 's/""/^I/g' -e 's/","/ -- /g'| tr '\t' '\n' | tr -d '"'
Note that you have to replace the literal "^I" in the line above with an actual tab character. For some reason, my sed is not liking '\t' instead of a literal tab character, and of course cutting-n-pasting a real tab character isn't going to work here.
Anyway, here's the first few lines of output from the command above:
a2ps -- Any-to-PostScript filter
a52dec -- Library for decoding ATSC A/52 streams (AKA 'AC-3')
aacgain -- AAC-supporting version of mp3gain
aalib -- Portable ASCII art graphics library
aamath -- Renders mathematical expressions as ASCII art
aap -- Make-like tool to download, build, and install software
aardvark_shell_utils -- Utilities to aid shell scripts or command-line users
abcde -- Better CD Encoder
abcl -- Armed Bear Common Lisp: a full implementation of Common Lisp
abcm2ps -- ABC music notation software
And here's the last few lines of output from the command above:
zssh -- Interactive file transfers over SSH
zstd -- Zstandard is a real-time compression algorithm
zsxd -- Zelda Mystery of Solarus XD
zsync -- File transfer program
zurl -- HTTP and WebSocket client worker with ZeroMQ interface
zxcc -- CP/M 2/3 emulator for cross-compiling and CP/M tools under UNIX
zxing-cpp -- C++ port of the ZXing barcode decoder
zyre -- Local Area Clustering for Peer-to-Peer Applications
zzuf -- Transparent application input fuzzer
zzz -- Command-line tool to put Macs to sleep
There you go! If you redirect that output to a file, you can then quickly grep the file for whatever kind of description you're looking for.
For example, if you're looking for compression commands, doing a brew search compress isn't very useful:
$ brew search compress
==> Searching local taps...
htmlcompressor ncompress yuicompressor
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
But if we saved the output from the command above into a file in /tmp/brew.txt, then a simple grep compress /tmp/brew.txt returns 60 hits! Let's take a look at the first few:
$ grep -i compress /tmp/brew.txt | head
advancecomp -- Recompression utilities for .PNG, .MNG, .ZIP, and .GZ files
afsctool -- Utility for manipulating HFS+ compressed files
aften -- Audio encoder which generates ATSC A/52 compressed audio streams
archivemail -- Tool for archiving and compressing old email in mailboxes
brotli -- Generic-purpose lossless compression algorithm by Google
bzip2 -- Freely available high-quality data compressor
draco -- 3D geometric mesh and point cloud compression library
ecm -- Prepare CD image files so they compress better
epsilon -- Powerful wavelet image compressor
exomizer -- 6502 compressor with CBM PET 4032 support
So, if you were looking for advanced compression programs like brotli or zstd, but you didn't know the exact names to look for, then brew search compress would not be useful for you, but grepping through the output of the above command would return those two plus 58 more hits!
You're welcome! ;)
[ EDIT: Whoops! Sorry, I had forgotten to remove the runtime_dependencies from the previous version of the script. Sigh.... ]
- 154
When you have fzf and jq installed you get a nice-looking, fuzzy searcheable selection list by running:
brew info --json --eval-all \
| jq -r '.[].name' \
| fzf --cycle --tmux --preview 'brew info {}' --color bg:#222222,preview-bg:#333333 --info=inline-right --ellipsis=… --tabstop=4 --highlight-line
- 101
As of version 4.4, and I believe going back to version 2.6, there has been a command to list all the available formulas:
brew formulae
List all locally installable formulae including short names.
-d, --debug Display any debugging information.
-q, --quiet Make some output more quiet.
-v, --verbose Make some output more verbose.
-h, --help Show this message.
This is the same functionality that is used for shell completions, like when you type brew search and hit tab.
The result is long (over 7k lines) on my machine, so you will want to page or pipe it to a file.
- 121
grep desc $(brew --prefix)/Library/Formula/*.rb | perl -ne 'm{^.*/(.*?)\.rb.*?\"(.*)"$} and print "$1\t$2\n"'
- 1
