From d51a9ebb0e8b2830464d608fbccdd6eb787bea86 Mon Sep 17 00:00:00 2001 From: Netanel Draiman Date: Tue, 13 Jan 2026 15:42:05 +0200 Subject: [PATCH] fix(daemon): enable launchd service before bootstrap When a launchd service is uninstalled via bootout, macOS marks it as disabled in /var/db/com.apple.xpc.launchd/disabled.*.plist. This persists across reboots and plist recreation. Future bootstrap calls fail with error 5 (I/O error) because the service is still marked disabled. Fix: Call 'launchctl enable' before 'launchctl bootstrap' to clear the disabled state, matching the fix already applied to the macOS Swift app in GatewayLaunchAgentManager.swift. Related: #306 --- src/daemon/launchd.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index 5e9776f74..a59c9d330 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -410,6 +410,7 @@ export async function installLaunchAgent({ await execLaunchctl(["bootout", domain, plistPath]); await execLaunchctl(["unload", plistPath]); + await execLaunchctl(["enable", `${domain}/${label}`]); const boot = await execLaunchctl(["bootstrap", domain, plistPath]); if (boot.code !== 0) { throw new Error(`launchctl bootstrap failed: ${boot.stderr || boot.stdout}`.trim());