Skip to content

Instantly share code, notes, and snippets.

@wenkokke
Created March 2, 2014 14:27
Show Gist options
  • Save wenkokke/9307348 to your computer and use it in GitHub Desktop.
Save wenkokke/9307348 to your computer and use it in GitHub Desktop.
Small bash script that determines by which packages a Brew package is used.
#!/bin/bash
if [[ -z "$1" ]]; then
echo "usage: witch [package name]"
else
# iterate over all installed packages
for pkg in $( brew list ); do
# iterate over all their dependencies
for dep in $( brew deps $pkg ); do
if [ "$dep" == "$1" ]; then
echo "$pkg"
fi
done
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment