What is tree?
tree displays directory contents as a hierarchy.
Homebrew installs tree as a formula: a package definition for command-line software and its dependencies. If Homebrew is not installed yet, follow the official installation guide before continuing.
Install and check the formula
Refresh Homebrew’s package definitions, then install tree. Use brew info to inspect the current package and its dependencies; the actual installed version can change over time.
brew update
brew install tree
brew info treeTry it
Limit the display to two levels to understand a project’s layout without flooding the terminal.
tree --version
tree -L 2 .Before you rely on it
Large directories can produce very long output, and filenames may contain sensitive information. Review output before sharing it.
ls is already available on macOS for simple directory listings.
Update or remove it
Run brew outdated to see if a newer version is available, and brew upgrade tree to upgrade this formula. Before removing it, preview the changes; other packages may depend on it.
brew outdated
brew upgrade tree
brew uninstall --dry-run tree