brew autoremove
Remove unused formulae previously installed as dependencies. More information: https://docs.brew.sh/Manpage#autoremove---dry-run.
- Remove all unused formulae:
brew autoremove
- Print what would be removed, but don't actually remove anything:
brew autoremove --dry-run