Last active
March 19, 2018 23:26
-
-
Save connorworley/4e4bfb715754c88fd9b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
declare -A visited_formulas | |
check_formulas() { | |
for formula in "$@"; do | |
if [[ -z `brew uses --installed $formula` ]] && ! (( ${+visited_formulas[$formula]} )) && [[ $formula != "brew-cask" ]]; then | |
read "input?$formula is not depended on by other formulas. Remove? [Y/n] " | |
visited_formulas[$formula]=1 | |
if [[ "$input" == "Y" ]]; then | |
brew remove $formula | |
check_formulas `brew deps --1 --installed $formula` | |
fi | |
fi | |
done | |
} | |
echo "Searching for formulas not depended on by other formulas..." | |
check_formulas `brew list` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment