fix: launchd plist includes PATH with Homebrew + user local bin

launchd agents run with minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin).
Homebrew binaries (tmux, ttyd) in /opt/homebrew/bin and uv tool installs
in ~/.local/bin were not found, causing _check_dependencies() to exit(1).
Plist now includes EnvironmentVariables with a PATH that covers both
Apple Silicon and Intel Homebrew locations + ~/.local/bin.
This commit is contained in:
Brian Krabach
2026-03-30 16:39:02 -07:00
parent 320c9f3ba7
commit 2a30e88feb
+19
View File
@@ -364,6 +364,20 @@ def _install_launchd(executable: str) -> None:
<string>0.0.0.0</string> <string>0.0.0.0</string>
</array>""" </array>"""
# Build PATH that includes Homebrew and common tool locations.
# launchd agents run with a minimal PATH (/usr/bin:/bin:/usr/sbin:/sbin).
# Homebrew binaries (tmux, ttyd, uv, git) won't be found without this.
_homebrew_paths = [
"/opt/homebrew/bin", # Apple Silicon Homebrew
"/usr/local/bin", # Intel Homebrew + system extras
"/opt/homebrew/sbin",
"/usr/local/sbin",
]
_user_local = str(Path.home() / ".local" / "bin") # uv/pip tool installs
_extra = [_user_local] + _homebrew_paths
_base = "/usr/bin:/bin:/usr/sbin:/sbin"
_service_path = ":".join(_extra) + ":" + _base
label = "com.muxplex" label = "com.muxplex"
uid = os.getuid() uid = os.getuid()
plist = f"""<?xml version="1.0" encoding="UTF-8"?> plist = f"""<?xml version="1.0" encoding="UTF-8"?>
@@ -374,6 +388,11 @@ def _install_launchd(executable: str) -> None:
<string>{label}</string> <string>{label}</string>
<key>ProgramArguments</key> <key>ProgramArguments</key>
{program_args} {program_args}
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>{_service_path}</string>
</dict>
<key>RunAtLoad</key> <key>RunAtLoad</key>
<true/> <true/>
<key>KeepAlive</key> <key>KeepAlive</key>