Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lotharschulz/b1252dd64aa6547e80c78d9290b91aa2 to your computer and use it in GitHub Desktop.
Save lotharschulz/b1252dd64aa6547e80c78d9290b91aa2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
EXCLUDED_PACKAGES=("package1" "package2" "package3")
while [[ `brew list | wc -l` -ne 0 ]]; do
for EACH in `brew list`; do
if [[ ! " ${EXCLUDED_PACKAGES[@]} " =~ " ${EACH} " ]]; then
brew uninstall --force --ignore-dependencies $EACH
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment