From e8f46a7a1c7db44962d3eef4cb2fd359947c79b6 Mon Sep 17 00:00:00 2001 From: Andrei Murariu <83287213+iamxorum@users.noreply.github.com> Date: Mon, 2 Feb 2026 05:26:58 +0200 Subject: [PATCH] feat: Homebrew uninstall with `--zap` flag (#397) Uninstalling mole with Zap will automatically remove also the directories that brew creates for it. -> More complete uninstallation Also updated the test about uninstalling --- lib/uninstall/brew.sh | 4 ++-- tests/brew_uninstall.bats | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/uninstall/brew.sh b/lib/uninstall/brew.sh index adba229..0e7ae90 100644 --- a/lib/uninstall/brew.sh +++ b/lib/uninstall/brew.sh @@ -171,7 +171,7 @@ brew_uninstall_cask() { is_homebrew_available || return 1 [[ -z "$cask_name" ]] && return 1 - debug_log "Attempting brew uninstall --cask $cask_name" + debug_log "Attempting brew uninstall --cask --zap $cask_name" # Ensure we have sudo access if needed, to prevent brew from hanging on password prompt if [[ "${NONINTERACTIVE:-}" != "1" && -t 0 && -t 1 ]]; then @@ -198,7 +198,7 @@ brew_uninstall_cask() { # Run with timeout to prevent hangs from problematic cask scripts local brew_exit=0 if HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \ - run_with_timeout "$timeout" brew uninstall --cask "$cask_name" 2>&1; then + run_with_timeout "$timeout" brew uninstall --cask --zap "$cask_name" 2>&1; then uninstall_ok=true else brew_exit=$? diff --git a/tests/brew_uninstall.bats b/tests/brew_uninstall.bats index ecd880b..2547f01 100644 --- a/tests/brew_uninstall.bats +++ b/tests/brew_uninstall.bats @@ -117,7 +117,7 @@ total_size_cleaned=0 # Simulate 'Enter' for confirmation printf '\n' | batch_uninstall_applications > /dev/null 2>&1 -grep -q "uninstall --cask brew-app-cask" "$HOME/brew_calls.log" +grep -q "uninstall --cask --zap brew-app-cask" "$HOME/brew_calls.log" EOF [ "$status" -eq 0 ]