Shell Script to Detect Homebrew Packages with No Dependents

A simple shell script to find Homebrew packages that are not depended on by any other installed packages, helping you identify candidates for removal.

for pkg in $(brew list); do
  if [ -z "$(brew uses --installed $pkg)" ]; then
    echo "$pkg can be uninstalled"
  fi
done