Is there a way to get a list of all formulas (packages) I can install using homebrew for Mac OS X?
6 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 {} \;
- 223,558
- 70
- 607
- 592
-
2Or for a third option, `ls $(brew --prefix)/Library/Formula` – mk12 Aug 19 '12 at 21:19
-
2`brew server` is unsupported and will be removed soon. You should use http://braumeister.org instead. – Michael Dorst Aug 17 '14 at 08:02
-
`brew server` seems to have been removed now (accurate as of Homebrew 0.9.5 (git revision 5745; last commit 2016-01-04)) – stkent Jan 28 '16 at 16:53
-
https://github.com/mxcl/homebrew/tree/master/Library/Formula this no longer works. Gives a 404 – cavalcade Sep 09 '16 at 02:14
-
1@MattTagg Thanks, I fixed the link. They split up the formulas into different repos now. – slhck Sep 09 '16 at 07:20
-
Local Git repository has changes to `/user/local/Homebrew/Library/Tabs` on my Homebew 1.0.6. – lingceng Oct 06 '16 at 08:32
-
Note that browsing the formula directory on the Github website won't really work, since it truncates the list to the first 1,000 formula. As of this writing, that means that 3,500 formula are not shown in that list. – M. Justin Mar 25 '18 at 20:58
-
@M.Justin You're right. I guess back when I wrote this, there weren't even that many. – slhck Mar 26 '18 at 06:15
-
`brew info --all` does not work on my macOS 10.14.6, Homebrew 2.1.15 system, but `brew info --all --json` does. I've submitted a corresponding edit to the question. – Johnny Utahh Oct 24 '19 at 19:23
Apart from the things slhck mentioned, there's an online package browser available at formulae.brew.sh.
- 1,798
- 2
- 18
- 27
- 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.
- 7
- 4
- 11
- 3
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.
- 1,798
- 2
- 18
- 27
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
- 1
- 5
grep desc $(brew --prefix)/Library/Formula/*.rb | perl -ne 'm{^.*/(.*?)\.rb.*?\"(.*)"$} and print "$1\t$2\n"'
- 1
-
3Welcome to Super User! While this may answer the question, it would be a better answer if you could provide some explanation **why** it does so. – DavidPostill Jul 29 '15 at 20:20