Listing Homebrew Packages on macOS: Two Methods
Learn how to view all installed Homebrew packages and casks via terminal commands.
1Homebrew Package Manager Overview
Homebrew is the most popular command-line package manager for macOS, allowing users to install thousands of Unix tools and open-source applications. It simplifies software installation without requiring admin privileges and maintains packages in their own directory. Homebrew handles both traditional packages (formulae) and GUI applications (casks), with over 5,000 formulae and 1,000 casks available. The tool automatically handles dependencies and updates, making it essential for developers and power users.
2When You Need Package Lists
Checking installed Homebrew packages helps when troubleshooting conflicts, documenting system configurations, or preparing for system migrations. Developers often need this when setting up new machines or debugging environment issues. System administrators use package lists for inventory management and security audits. The information is also valuable before major macOS upgrades to identify potential compatibility issues with existing packages.
3The brew list Command
The basic 'brew list' command displays all installed formulae and casks in separate sections. Formulae are traditional command-line packages, while casks are GUI applications. The output shows package names without versions, organized alphabetically. This comprehensive view includes all dependencies, making it useful for complete system documentation. The command executes instantly as it reads from Homebrew's local database rather than querying online repositories.
4Sample brew list Output
A typical output shows 20-30 packages for average users, including development tools like git, python, and openssl, utilities like wget and htop, and libraries like pcre and libffi. Casks might include applications like visual-studio-code or google-chrome. The output format uses simple spacing without columns for easy parsing. Each section begins with a header (# Formulae or # Casks) followed by alphabetical listings in lowercase, with multiple packages per line.
5The brew leaves Command
Unlike 'brew list', 'brew leaves' shows only top-level packages explicitly installed by the user, excluding dependencies. This cleaner view helps identify intentionally installed software rather than automatic dependencies. The command doesn't include casks, focusing solely on formulae. It's particularly useful when pruning unnecessary packages or replicating environments, as it shows only packages that would need manual reinstallation on a new system.
6Comparing Both Methods
While 'brew list' provides complete visibility including dependencies, 'brew leaves' offers a simplified view of user-installed packages. The former is better for debugging and complete system documentation, while the latter suits environment replication and cleanup. Neither command shows version numbers by default, requiring 'brew info' for detailed package data. Both work offline as they access local package databases rather than network resources.
7Practical Usage Scenarios
Developers often pipe these commands to text files for documentation ('brew list > packages.txt'). System administrators might combine them with grep to find specific packages. The lists help when writing setup scripts or Dockerfiles to recreate environments. Before uninstalling Homebrew, these commands provide a backup of installed packages. They're also useful for compliance audits in corporate environments tracking software installations.
8Essential Maintenance Tool
Knowing installed packages is fundamental for macOS system maintenance. These commands help maintain clean development environments and troubleshoot issues. Regular checks prevent dependency bloat and identify outdated packages. As Homebrew manages critical development tools, these listing capabilities form the foundation for more advanced package management workflows, including updates, upgrades, and migrations between systems.
Original article: OS X Daily — Listing Homebrew Packages on macOS: Two Methods