mirror of
https://github.com/Heretek-AI/opencode.git
synced 2026-11-21 11:19:27 -10:00
A managed service elected by a GUI client (the desktop app, an editor, a login item) inherits launchd's environment: PATH is /usr/bin:/bin:/usr/sbin:/sbin and nothing exported from .zshrc or .bashrc exists. Every process the server spawns extends process.env, so stdio MCP servers using #!/usr/bin/env node, npx, uvx, formatters, and hooks fail with "Connection closed" while the bash tool, which prefers the client's terminal environment, keeps working. Resolve the user's interactive login shell once at service startup when the inherited environment did not come from a shell, and adopt it before anything reads process.env.