Homebrew/homebrew-cask · warning

Unable to forcibly close BlurScreen.app

Error message

Unable to forcibly close BlurScreen.app

What it means

Printed by the terminate_process step in blurscreen's postflight_steps (Casks/b/blurscreen.rb:33). The BlurScreen .pkg postinstall script runs `open "$APP_PATH"&` and auto-launches BlurScreen.app, so Homebrew follows up with `/usr/bin/pkill -f /Applications/BlurScreen.app`, up to `attempts: 3` times with 1-second sleeps. pkill returns non-zero when no process's full command line matches that path or when the signal cannot be delivered; after the final failed attempt Homebrew prints this failure_message as a `Warning:`. With `must_succeed: false` the step is advisory — the cask install always continues.

Source

Thrown at Casks/b/blurscreen.rb:33

  auto_updates true
  depends_on :macos

  pkg "BlurScreen-v2.pkg"

  postflight_steps do
    # Description: Ensure console variant of postinstall is non-interactive.
    # This is because `open "$APP_PATH"&` is called from the postinstall
    # script of the package and we don't want any user intervention there.
    terminate_process(
      "/Applications/BlurScreen.app",
      match:           :full,
      attempts:        3,
      must_succeed:    false,
      notices:         [
        "The BlurScreen package postinstall script launches the BlurScreen app",
        "Attempting to close BlurScreen.app to avoid unwanted user intervention",
      ],
      failure_message: "Unable to forcibly close BlurScreen.app",
    )
  end

  uninstall quit:    "com.sanskar.blurscreen",
            pkgutil: "com.sanskar.blurscreen",
            delete:  "/Applications/BlurScreen.app"

  zap trash: [
    "~/Library/Caches/com.sanskar.blurscreen",
    "~/Library/HTTPStorages/com.sanskar.blurscreen",
    "~/Library/Preferences/com.sanskar.blurscreen.plist",
  ]
end

View on GitHub (pinned to 8587086220)

Solutions

  1. Treat the warning as informational when brew completed — `must_succeed: false` by design; afterwards quit any leftover app with `pkill -f /Applications/BlurScreen.app`.
  2. Quit BlurScreen before the operation (`osascript -e 'quit app "BlurScreen"'`), then re-run `brew reinstall --cask blurscreen`.
  3. Verify install state with `brew list --cask --versions blurscreen` rather than re-running.
  4. If the app is running under a different path (`pgrep -fl BlurScreen`), update the literal path in the cask (`brew edit --cask blurscreen`) and submit a PR.

Example fix

# before
brew upgrade --cask blurscreen
# Warning: Unable to forcibly close BlurScreen.app

# after: quit the screen-dimmer app first, then upgrade
osascript -e 'quit app "BlurScreen"' || pkill -f '/Applications/BlurScreen.app'
brew upgrade --cask blurscreen
Defensive patterns

Strategy: validation

Validate before calling

# Before brew install/upgrade --cask blurscreen, make sure BlurScreen is not running:
osascript -e 'quit app "BlurScreen"' 2>/dev/null || pkill -f '/Applications/BlurScreen.app' 2>/dev/null || true
brew reinstall --cask blurscreen

Try / catch

begin
  Homebrew::SystemCommand.run!("/usr/bin/pkill", args: ["-f", "/Applications/BlurScreen.app"])
rescue ErrorDuringExecution
  # No command line matched the path: app not running. Non-fatal by design.
  warn "Unable to forcibly close BlurScreen.app"
end

Prevention

When it happens

Trigger: `brew install|upgrade|reinstall --cask blurscreen` where the BlurScreen process never appears within the retry window: postinstall's `open` failed (no GUI session, e.g. SSH), the app launched after the third pkill attempt, a running copy lives at a different path (~/Applications or a renamed bundle), or pkill could not signal the process. Each failed attempt raises ErrorDuringExecution internally; after attempts hit zero the warning is printed.

Common situations: Automated/CI installs without a logged-in desktop user; the app is quit by the user faster than the retry loop samples it; vendor renames the bundle in a pkg update; an older manual install of BlurScreen running from another location.

Related errors


AI-assisted analysis of Homebrew/homebrew-cask@8587086220 (2026-08-21). Data as JSON: /api/errors/5e46a37b0a579aa5. Report an issue: GitHub.