Skip to content

fix(auto-updates): use LaunchDaemon for brew, native macOS for MAS#62

Merged
smartwatermelon merged 2 commits intomainfrom
claude/fix-auto-updates-launchdaemon-1771010138
Feb 13, 2026
Merged

fix(auto-updates): use LaunchDaemon for brew, native macOS for MAS#62
smartwatermelon merged 2 commits intomainfrom
claude/fix-auto-updates-launchdaemon-1771010138

Conversation

@smartwatermelon
Copy link
Owner

Summary

  • Homebrew: Convert from LaunchAgent to LaunchDaemon with UserName key — LaunchAgents never fire because the administrator is rarely logged in on the desktop GUI
  • Mac App Store: Replace mas LaunchAgent with native macOS auto-update (defaults write com.apple.commerce AutoUpdate)
  • Cleanup: Add function to remove old LaunchAgents from prior deployment
  • Fix: --force now bypasses "already configured" early return
  • Docs: Update docs/vpn-transmission.md Stage 5 table

Context

LaunchAgents only run when the user has an active GUI session. The administrator account on the Mac Mini is almost never logged in on the desktop (the operator user has the persistent GUI session via auto-login). This means all LaunchAgents under the administrator account never execute.

LaunchDaemons run regardless of GUI session state. The UserName plist key causes launchd to drop privileges from root to the specified user before executing the program, so the brew upgrade runs as the administrator (who owns Homebrew) without running as root.

For Mac App Store, mas upgrade also requires a GUI session context, so we use the native macOS auto-update mechanism instead (com.apple.commerce AutoUpdate).

Test plan

  • Run setup-auto-updates.sh --force on target server
  • Verify LaunchDaemon exists: sudo launchctl list | grep brew-upgrade
  • Verify old LaunchAgents removed from ~/Library/LaunchAgents/
  • Verify MAS auto-update: defaults read /Library/Preferences/com.apple.commerce AutoUpdate
  • Verify softwareupdate daemon: sudo launchctl list | grep softwareupdate
  • Check brew upgrade log after 24h: cat ~/.local/state/tilsit-brew-upgrade.log

🤖 Generated with Claude Code

LaunchAgents under the administrator account never fire because that
user is rarely logged in on the desktop GUI. Convert to LaunchDaemons
(which run regardless of GUI session) with UserName key to drop
privileges to the administrator user.

Changes:
- Homebrew: LaunchAgent -> LaunchDaemon with UserName key
- MAS: Replace mas LaunchAgent with native macOS auto-update
  (defaults write com.apple.commerce AutoUpdate)
- Add cleanup function to remove old LaunchAgents from prior deployment
- Fix --force to bypass "already configured" early return
- Update docs/vpn-transmission.md Stage 5 table

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If run with sudo, whoami returns "root", misconfiguring the
LaunchDaemon UserName and LOG_DIR. Add EUID check matching
the pattern in setup-remote-desktop.sh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@smartwatermelon smartwatermelon merged commit 840bef8 into main Feb 13, 2026
17 checks passed
@smartwatermelon smartwatermelon deleted the claude/fix-auto-updates-launchdaemon-1771010138 branch February 13, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant