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`); }