{"record":{"id":"b271b951b5e01675","repo":"Homebrew/homebrew-cask","slug":"unable-to-forcibly-close-uu-remote","errorCode":null,"errorMessage":"Unable to forcibly close UU Remote","messagePattern":"Unable to forcibly close UU Remote","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"Casks/u/uuremote.rb","lineNumber":34,"sourceCode":"  end\n\n  depends_on :macos\n\n  pkg \"uuyc_#{version}.pkg\"\n\n  postflight_steps do\n    # The postinstall script automatically opens the app. Therefore, we must\n    # suppress this behavior to make the cask installation non-interactive.\n    terminate_process(\n      \"/Applications/UURemote.app\",\n      match:           :full,\n      attempts:        3,\n      must_succeed:    false,\n      notices:         [\n        \"The UU Remote package postinstall script launches the app\",\n        \"Attempting to close UU Remote to avoid unwanted user intervention\",\n      ],\n      failure_message: \"Unable to forcibly close UU Remote\",\n    )\n  end\n\n  uninstall launchctl: [\n              \"com.netease.uuremote.agent\",\n              \"com.netease.uuremote.daemon\",\n            ],\n            quit:      \"com.netease.uuremote\",\n            pkgutil:   \"com.netease.uuremote\",\n            delete:    [\n              \"/Applications/UURemote.app\",\n              \"/Library/Caches/UURemote\",\n              \"/Library/LaunchAgents/com.netease.uuremote.agent.plist\",\n              \"/Library/LaunchDaemons/com.netease.uuremote.daemon.plist\",\n            ]\n\n  zap trash: [\n    \"/Users/Shared/UURemote\",","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/Homebrew/homebrew-cask/blob/8587086220f4568daf43b90d1a0baf391e930c9e/Casks/u/uuremote.rb#L16-L52","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["If brew completed, treat the warning as benign (`must_succeed: false`); quit any leftover app with `pkill -f /Applications/UURemote.app`.","Quit UU Remote before the operation (`osascript -e 'quit app \"UU Remote\"'`), then re-run `brew reinstall --cask uuremote`.","If the app keeps relaunching, unload its helpers first: `launchctl bootout gui/$(id -u)/com.netease.uuremote.agent` and the matching daemon, then retry.","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."],"exampleFix":"# before\nbrew upgrade --cask uuremote\n# Warning: Unable to forcibly close UU Remote\n\n# after: quit the app and its helpers, then upgrade\nosascript -e 'quit app \"UU Remote\"' || pkill -f '/Applications/UURemote.app'\nlaunchctl bootout gui/$(id -u)/com.netease.uuremote.agent 2>/dev/null || true\nbrew upgrade --cask uuremote","handlingStrategy":"validation","validationCode":"# Quit the app and its launchd helpers before the brew operation:\nosascript -e 'quit app \"UU Remote\"' 2>/dev/null || pkill -f '/Applications/UURemote.app' 2>/dev/null || true\nlaunchctl bootout gui/$(id -u)/com.netease.uuremote.agent 2>/dev/null || true\nbrew reinstall --cask uuremote","typeGuard":null,"tryCatchPattern":"begin\n  Homebrew::SystemCommand.run!(\"/usr/bin/pkill\", args: [\"-f\", \"/Applications/UURemote.app\"])\nrescue ErrorDuringExecution\n  # Nothing matched, or the agent/daemon respawned the app. Non-fatal.\n  warn \"Unable to forcibly close UU Remote\"\nend","preventionTips":["Quit UU Remote before brew install/upgrade of the cask.","Unload com.netease.uuremote.agent/.daemon when the app keeps relaunching itself.","Treat the warning as advisory (must_succeed: false) and confirm success via `brew list --cask uuremote`.","On headless installs the warning is the norm; check the app state afterwards, not the warning."],"tags":["homebrew","cask","macos","uu-remote","pkill","process-termination","postflight","launchd-service"],"backgroundTag":"pkill-no-process-matched","analyzedSha":"8587086220f4568daf43b90d1a0baf391e930c9e","analyzedAt":"2026-08-21T15:13:24.144Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}