diff --git a/lib/uninstall/batch.sh b/lib/uninstall/batch.sh index c57a27f..3302aa2 100755 --- a/lib/uninstall/batch.sh +++ b/lib/uninstall/batch.sh @@ -388,6 +388,8 @@ batch_uninstall_applications() { # Stop Launch Agents/Daemons before removal. local has_system_files="false" [[ -n "$system_files" ]] && has_system_files="true" + + stop_launch_services "$bundle_id" "$has_system_files" # Remove from Login Items diff --git a/lib/uninstall/brew.sh b/lib/uninstall/brew.sh index 3811079..abb17a3 100644 --- a/lib/uninstall/brew.sh +++ b/lib/uninstall/brew.sh @@ -174,13 +174,24 @@ brew_uninstall_cask() { debug_log "Attempting brew uninstall --cask $cask_name" # Run uninstall with timeout (suppress hints/auto-update) + debug_log "Attempting brew uninstall --cask $cask_name" + + # Ensure we have sudo access if needed, to prevent brew from hanging on password prompt + # Many brew casks need sudo to uninstall + if ! sudo -n true 2> /dev/null; then + # If we don't have sudo, try to get it (visibly) + sudo -v + fi + local uninstall_ok=false - local output - if output=$(HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \ - run_with_timeout 120 brew uninstall --cask "$cask_name" 2>&1); then + + # Run directly without output capture to allow user interaction/visibility + # This avoids silence/hangs when brew asks for passwords or confirmation + if HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \ + brew uninstall --cask "$cask_name"; then uninstall_ok=true else - debug_log "brew uninstall output: $output" + debug_log "brew uninstall failed with exit code $?" fi # Verify removal