diff --git a/apps/macos/Sources/Clawdbot/GatewayLaunchAgentManager.swift b/apps/macos/Sources/Clawdbot/GatewayLaunchAgentManager.swift index f0896e691..09c598f65 100644 --- a/apps/macos/Sources/Clawdbot/GatewayLaunchAgentManager.swift +++ b/apps/macos/Sources/Clawdbot/GatewayLaunchAgentManager.swift @@ -51,8 +51,10 @@ enum GatewayLaunchAgentManager { static func set(enabled: Bool, bundlePath: String, port: Int) async -> String? { _ = bundlePath - guard !CommandResolver.connectionModeIsRemote() else { - self.logger.info("launchd change skipped (remote mode)") + // In remote mode, never enable the local gateway, but still allow disabling it + // so switching from local→remote properly unloads the launchd job. + if enabled, CommandResolver.connectionModeIsRemote() { + self.logger.info("launchd enable skipped (remote mode)") return nil } if enabled, self.isLaunchAgentWriteDisabled() {