Skip to content

Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

Rust

fix(macos): start launch agents after loading (#994)

Bhuvan Agrawal47cf1d9499e8
diff --git a/scripts/macos/install.sh b/scripts/macos/install.sh
index 43c97c9c0..2b8125dfd 100755
--- a/scripts/macos/install.sh
+++ b/scripts/macos/install.sh
@@ -188,7 +188,9 @@ for label in "$SERVER_LABEL" "$MENUBAR_LABEL"; do
sleep 0.1
done
launchctl bootstrap "gui/$UID" "$LAUNCH_AGENTS/$label.plist"
- say " loaded $label"
+ # macOS can defer RunAtLoad jobs until an explicit start is requested.
+ launchctl kickstart "gui/$UID/$label"
+ say " started $label"
done
step "Adding the sy Codex profile"
diff --git a/tests/test_macos_install.py b/tests/test_macos_install.py
index 6a2ce3a79..ccef74a2b 100644
--- a/tests/test_macos_install.py
+++ b/tests/test_macos_install.py
@@ -64,6 +64,29 @@ def read_config(path):
return path.read_text()
+def test_install_starts_each_launch_agent_after_loading_it(setup):
+ _, _, _, env = setup
+ command_log = Path(env["TMPDIR"]) / "launchctl.log"
+ stub = Path(env["PATH"].split(":")[0]) / "launchctl"
+ stub.write_text(
+ '#!/bin/bash\nset -eu\n'
+ f'printf "%s\\n" "$*" >> "{command_log}"\n'
+ '[[ "$1" != print ]]\n'
+ )
+
+ result = run(setup, "install.sh")
+
+ assert result.returncode == 0, result.stderr
+ commands = command_log.read_text().splitlines()
+ for label in ("com.nvidia.switchyard.server", "com.nvidia.switchyard.menubar"):
+ bootstrap = next(
+ index for index, command in enumerate(commands)
+ if command.startswith("bootstrap ") and command.endswith(f"/{label}.plist")
+ )
+ domain = commands[bootstrap].split()[1]
+ assert commands[bootstrap + 1] == f"kickstart {domain}/{label}"
+
+
def test_install_escapes_switchyard_path_in_launch_agent(setup):
_, home, switchyard_home, _ = setup
result = run(setup, "install.sh")