#4709: fix(daemon): include user bin dirs in macOS LaunchAgent PATH
gateway
Cluster:
Node and macOS Enhancements
## Summary
The LaunchAgent plist was missing user bin directories on macOS, causing skills that depend on binaries installed via user package managers (volta, pnpm, bun, cargo, etc.) to show as 'blocked' in the UI.
## Root Cause
The function `resolveLinuxUserBinDirs` already had all the logic to resolve user bin directories, but it was only being called for Linux:
```typescript
// Before (bug):
const linuxUserDirs =
platform === "linux" ? resolveLinuxUserBinDirs(options.home, options.env) : [];
```
## Changes
- Rename `resolveLinuxUserBinDirs` → `resolvePosixUserBinDirs` (more accurate name)
- Apply user bin dir resolution for both `linux` and `darwin` platforms
- Add macOS-specific pnpm path (`~/Library/pnpm`)
- Add cargo bin path (`~/.cargo/bin`)
## After
```typescript
// After (fixed):
const posixUserDirs =
platform === "linux" || platform === "darwin"
? resolvePosixUserBinDirs(options.home, options.env)
: [];
```
## Testing
1. Run `clawdbot gateway install` on macOS
2. Check `~/Library/LaunchAgents/com.clawdbot.gateway.plist`
3. Verify PATH includes user bin dirs (volta, pnpm, bun, etc.)
4. Confirm skills using those binaries show as 'ready' instead of 'blocked'
## Related
Fixes #4699
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the daemon’s service PATH construction to include common *user* bin directories on macOS (in addition to Linux), so launchd-launched processes can find binaries installed via user-scoped package managers (volta/pnpm/bun/cargo/etc.). It does so by renaming the helper to `resolvePosixUserBinDirs`, adding a couple of additional paths, and using it for both `linux` and `darwin` in `getMinimalServicePathParts`.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge and should improve launchd PATH behavior on macOS.
- Changes are localized to PATH construction and primarily add additional candidate directories plus a rename; the main risk is whether the added pnpm directory matches real-world macOS pnpm setups, but incorrect extra PATH entries are generally low impact.
- src/daemon/service-env.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#17951: fix: macOS app: Skill binary detection does not respect /etc/paths ...
by MisterGuy420 · 2026-02-16
82.1%
#12804: fix(daemon): use wrapper script for pnpm global installs in service...
by odinho · 2026-02-09
80.1%
#18112: fix(daemon): gateway install on macOS ignores fnm/nvm node (#18090)
by yinghaosang · 2026-02-16
79.1%
#6064: fix(daemon): prefer bundled node from install-cli.sh over system node
by joyshmitz · 2026-02-01
78.8%
#15345: fix(daemon): doctor --fix pollutes service PATH with dirs that don'...
by yinghaosang · 2026-02-13
77.7%
#17929: fix(skills): augment PATH with /etc/paths on macOS for binary detec...
by lailoo · 2026-02-16
77.3%
#20390: fix(daemon): fall back to /tmp for launchd logs on removable volumes
by lemoz · 2026-02-18
77.0%
#19931: Config: merge PATH env vars and bootstrap Windows bins
by Kemalau · 2026-02-18
76.9%
#23584: fix(daemon): improve gateway service detection to avoid false posit...
by mohandshamada · 2026-02-22
76.6%
#15619: fix: clean up orphan LaunchAgent plist on bootstrap failure
by superlowburn · 2026-02-13
76.0%