Skip to content

Instantly share code, notes, and snippets.

@eguven
Last active June 12, 2024 13:30
Show Gist options
  • Save eguven/23d8c9fc78856bd20f65f8bcf03e691b to your computer and use it in GitHub Desktop.
Save eguven/23d8c9fc78856bd20f65f8bcf03e691b to your computer and use it in GitHub Desktop.
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h
@eguven
Copy link
Author

eguven commented May 17, 2024

Thanks @redspot I've added an alternative using du -sch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment