Thingy Ma Jig is the blog of Nicholas Thompson and contains any useful tips, sites and general blog-stuff which are considered interesting or handy!
Posted on 22 September 2014 in
OS X
Homebrew
For anyone that uses Homebrew a lot, its very easy to amasse many casks (installed packages) and never quite know which ones are still needed. I did some googling and found a really interesting blog post by Mark H. Nichols about listing all brew dependencies.
I then decided to invert that logic; to list all my casks, with each one showing what uses it. Anything that has nothing using it is either an oprhaned cask or is something "standalone" which is not installed as a dependency on something else.
NOTE: The script from Mark's website uses zsh; I do not have that, I use plain old Bash. It is still possible to get colours though!
brew list -1 | while read cask; do echo -ne "\x1B[1;34m $cask \x1B[0m"; brew uses $cask --installed | awk '{printf(" %s ", $0)}'; echo ""; done
And some example output:
apple-gcc42 atk gtk+ pygtk autoconf automake php54-apc php54-mcrypt php54-memcache php54-tidy tsocks automake axel bison27 boot2docker cairo gtk+ harfbuzz pango py2cairo cmake percona-server55 ... ...
And a screenshot: