Created
June 28, 2025 13:51
-
-
Save mikr13/ddaf719f8df879da75e5655e813571ec to your computer and use it in GitHub Desktop.
brew-cleanup
This file contains hidden or 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/bash | |
# List of potentially safe-to-remove packages | |
CANDIDATES=( | |
# run brew ls | |
) | |
REMOVABLE=() | |
echo "Checking reverse dependencies of candidate formulas..." | |
for pkg in "${CANDIDATES[@]}"; do | |
users=$(brew uses --installed --recursive "$pkg") | |
if [ -z "$users" ]; then | |
echo "[REMOVABLE] $pkg" | |
REMOVABLE+=("$pkg") | |
else | |
echo "[IN USE] $pkg => used by: $users" | |
fi | |
done | |
echo "" | |
echo "=== Removable Packages Summary ===" | |
for pkg in "${REMOVABLE[@]}"; do | |
echo "$pkg" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment