Homebrew/homebrew-cask · warning

Unable to forcibly close UU Remote

Error message

Unable to forcibly close UU Remote

What it means

Printed by the terminate_process step in uuremote's postflight_steps (Casks/u/uuremote.rb:34). NetEase's UU Remote .pkg postinstall opens UURemote.app automatically; to keep the cask non-interactive Homebrew runs `/usr/bin/pkill -f /Applications/UURemote.app` up to 3 times, 1 second apart. pkill exits non-zero when no process's full command line contains that path (or signalling is denied); after the final failed attempt this failure_message is printed as a `Warning:` via opoo. Because the cask sets `must_succeed: false`, the message is advisory and the install always continues.

Source

Thrown at Casks/u/uuremote.rb:34

  end

  depends_on :macos

  pkg "uuyc_#{version}.pkg"

  postflight_steps do
    # The postinstall script automatically opens the app. Therefore, we must
    # suppress this behavior to make the cask installation non-interactive.
    terminate_process(
      "/Applications/UURemote.app",
      match:           :full,
      attempts:        3,
      must_succeed:    false,
      notices:         [
        "The UU Remote package postinstall script launches the app",
        "Attempting to close UU Remote to avoid unwanted user intervention",
      ],
      failure_message: "Unable to forcibly close UU Remote",
    )
  end

  uninstall launchctl: [
              "com.netease.uuremote.agent",
              "com.netease.uuremote.daemon",
            ],
            quit:      "com.netease.uuremote",
            pkgutil:   "com.netease.uuremote",
            delete:    [
              "/Applications/UURemote.app",
              "/Library/Caches/UURemote",
              "/Library/LaunchAgents/com.netease.uuremote.agent.plist",
              "/Library/LaunchDaemons/com.netease.uuremote.daemon.plist",
            ]

  zap trash: [
    "/Users/Shared/UURemote",

View on GitHub (pinned to 8587086220)

Solutions

  1. If brew completed, treat the warning as benign (`must_succeed: false`); quit any leftover app with `pkill -f /Applications/UURemote.app`.
  2. Quit UU Remote before the operation (`osascript -e 'quit app "UU Remote"'`), then re-run `brew reinstall --cask uuremote`.
  3. If the app keeps relaunching, unload its helpers first: `launchctl bootout gui/$(id -u)/com.netease.uuremote.agent` and the matching daemon, then retry.
  4. Check `pgrep -fl UURemote` for the real running path; if it differs from the cask's literal /Applications/UURemote.app, fix the cask (`brew edit --cask uuremote`) and open a PR.

Example fix

# before
brew upgrade --cask uuremote
# Warning: Unable to forcibly close UU Remote

# after: quit the app and its helpers, then upgrade
osascript -e 'quit app "UU Remote"' || pkill -f '/Applications/UURemote.app'
launchctl bootout gui/$(id -u)/com.netease.uuremote.agent 2>/dev/null || true
brew upgrade --cask uuremote
Defensive patterns

Strategy: validation

Validate before calling

# Quit the app and its launchd helpers before the brew operation:
osascript -e 'quit app "UU Remote"' 2>/dev/null || pkill -f '/Applications/UURemote.app' 2>/dev/null || true
launchctl bootout gui/$(id -u)/com.netease.uuremote.agent 2>/dev/null || true
brew reinstall --cask uuremote

Try / catch

begin
  Homebrew::SystemCommand.run!("/usr/bin/pkill", args: ["-f", "/Applications/UURemote.app"])
rescue ErrorDuringExecution
  # Nothing matched, or the agent/daemon respawned the app. Non-fatal.
  warn "Unable to forcibly close UU Remote"
end

Prevention

When it happens

Trigger: `brew install|upgrade|reinstall --cask uuremote` where every pkill attempt fails: the app was never launched (postinstall `open` failed — headless/SSH session with no GUI), the launch exceeded the ~3s retry window, a running copy lives at a different path, or the respawn behaviour of the vendor's launchd jobs (com.netease.uuremote.agent / .daemon listed in the uninstall stanza) kept the process out of reach of the user-level pkill.

Common situations: CI or remote installs without a logged-in desktop session; the agent/daemon pair relaunching the app after each kill attempt; vendor renaming UURemote.app in a pkg update; user quitting the app inside the retry window.

Related errors


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