From 22ee3e3f4b22509a81f7543e843247cabe6671c8 Mon Sep 17 00:00:00 2001 From: HirokiKobayashi-R Date: Thu, 29 Jan 2026 16:08:57 +0900 Subject: [PATCH] fix(gateway): use launchctl stop instead of bootout for gateway stop `gateway stop` was using `launchctl bootout` which completely unloads the LaunchAgent from launchd. This meant `gateway start` would fail because the service registration was gone. Changed to `launchctl stop` which stops the service but keeps it registered, allowing `gateway start` to work without reinstalling. Fixes #3780 --- src/daemon/launchd.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index 747494bf7..7f473fac5 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -357,9 +357,11 @@ export async function stopLaunchAgent({ }): Promise { const domain = resolveGuiDomain(); const label = resolveLaunchAgentLabel({ env }); - const res = await execLaunchctl(["bootout", `${domain}/${label}`]); + // Use "stop" instead of "bootout" to keep the service registered. + // This allows "gateway start" to work without reinstalling. + const res = await execLaunchctl(["stop", `${domain}/${label}`]); if (res.code !== 0 && !isLaunchctlNotLoaded(res)) { - throw new Error(`launchctl bootout failed: ${res.stderr || res.stdout}`.trim()); + throw new Error(`launchctl stop failed: ${res.stderr || res.stdout}`.trim()); } stdout.write(`${formatLine("Stopped LaunchAgent", `${domain}/${label}`)}\n`); }