Skip to content

macOS: Gateway daemon PATH excludes user bin dirs (nix, bun, local, etc.) #97992

Description

@fompi

Summary

On macOS, the Gateway daemon service PATH excludes user bin directories — including ~/.nix-profile/bin, ~/.bun/bin, ~/.local/bin, and other common user-level binary paths. This means tools installed via Nix (and other user-level package managers) are unavailable to exec commands run by the Gateway.

Root cause

OpenClaw already has code to detect Nix profile paths (addNixProfileBinDirs in runtime-paths) and other user bin dirs (resolveDarwinUserBinDirs). However, getMinimalServicePathParts disables user dirs on macOS by default:

// runtime-paths
const includeUserDirs = options.includeUserDirs ?? platform !== "darwin";

This means resolveDarwinUserBinDirs (which calls addNixProfileBinDirs, addCommonUserBinDirs, etc.) is never invoked on macOS.

Additionally, mergeServicePath does not preserve existing PATH entries on macOS:

// auth-install-policy
addPath(nextPath);
if (platform !== "darwin") addPath(existingPath, { preserve: true });

So even if the operator manually edits ~/.openclaw/service-env/ai.openclaw.gateway.env to add extra PATH dirs, those changes are lost on the next openclaw gateway install.

Expected behavior

User bin directories (especially ~/.nix-profile/bin) should be included in the daemon PATH on macOS, just as they are on Linux. The detection code already exists — it's just gated behind includeUserDirs = false for darwin.

Suggested fix

One or both of:

  1. Change default: Set includeUserDirs = true for darwin in getMinimalServicePathParts, matching Linux behavior.
  2. Add config option: Expose a config setting (e.g. env.servicePath.includeUserDirs: true or env.servicePath.extraDirs: ["/Users/me/.nix-profile/bin"]) so operators can opt in without code changes.

Workaround

Manually edit ~/.openclaw/service-env/ai.openclaw.gateway.env to prepend the nix profile bin dir to PATH. This must be re-applied after every openclaw gateway install.

Environment

  • OS: macOS (Darwin)
  • OpenClaw: 2026.6.10
  • Nix installed via nix-daemon, ~/.nix-profile/bin populated

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions