codex - 💡(How to fix) Fix macOS Seatbelt sandbox blocks libproc/sysmon process listing for ps/pgrep [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#23505Fetched 2026-05-20 03:48:45
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Inside Codex CLI on macOS, ps, pgrep, top, lsof and any libproc-backed process query fail with sysmon request failed with error: sysmond service not found / Cannot get process list. The Seatbelt profile generated by Codex doesn't allow mach-lookup of com.apple.sysmond.system, which is what libproc uses for process inspection.

There is currently no documented config.toml knob in Codex CLI 0.131.0 to whitelist this specific mach service or to mark read-only process-inspection commands as trusted. The only escape is sandbox_mode = "danger-full-access", which removes all file/network protections — not a viable trade for the use case.

Error Message

Environment:

macOS Darwin 25.3 (Apple Silicon)

Codex CLI 0.131.0

~/.codex/config.toml:

sandbox_mode = "workspace-write"

approval_policy = "never"

default_permissions = "secret-fence"

[permissions.secret-fence.filesystem]

":root" = "read"

"/Users/<you>/.mcp-creds/**" = "none"

"/Users/<you>/.ssh/**" = "none"

Inside a Codex session, ask it to run:

pgrep -fl workspace-mcp ps -ax | head

Result:

sysmon request failed with error: sysmond service not found pgrep: Cannot get process list

Root Cause

Confirmed from upstream source:

  • seatbelt_base_policy.sbpl (compiled in via include_str!) does not include (allow mach-lookup (global-name "com.apple.sysmond.system")).
  • seatbelt.rs assembles the profile programmatically and passes it to /usr/bin/sandbox-exec -p <profile>. The profile is not written to disk, so end users cannot patch it without forking and rebuilding Codex CLI.
  • The published Seatbelt mach allowlists do include services like com.apple.SecurityServer, com.apple.networkd, and com.apple.trustd.agent — but not com.apple.sysmond.system.

Fix Action

Fix / Workaround

  • seatbelt_base_policy.sbpl (compiled in via include_str!) does not include (allow mach-lookup (global-name "com.apple.sysmond.system")).
  • seatbelt.rs assembles the profile programmatically and passes it to /usr/bin/sandbox-exec -p <profile>. The profile is not written to disk, so end users cannot patch it without forking and rebuilding Codex CLI.
  • The published Seatbelt mach allowlists do include services like com.apple.SecurityServer, com.apple.networkd, and com.apple.trustd.agent — but not com.apple.sysmond.system.

Code Example

# Environment:
# macOS Darwin 25.3 (Apple Silicon)
# Codex CLI 0.131.0
# ~/.codex/config.toml:
#   sandbox_mode = "workspace-write"
#   approval_policy = "never"
#   default_permissions = "secret-fence"
#   [permissions.secret-fence.filesystem]
#   ":root" = "read"
#   "/Users/<you>/.mcp-creds/**" = "none"
#   "/Users/<you>/.ssh/**"       = "none"

# Inside a Codex session, ask it to run:
pgrep -fl workspace-mcp
ps -ax | head

# Result:
sysmon request failed with error: sysmond service not found
pgrep: Cannot get process list

---

[sandbox.macos]
   allow_mach_lookups = ["com.apple.sysmond.system"]

---

codex --version  # confirm fix released
pgrep -fl workspace-mcp   # should succeed
ps -axo pid,ppid,command | head  # should succeed
lsof -nP -iTCP -sTCP:LISTEN | head  # should succeed

# Confirm file fences still enforced:
touch ~/.mcp-creds/sandbox-test  # should fail (denied)
ls ~/.ssh                         # should fail (denied)
RAW_BUFFERClick to expand / collapse

Summary

Inside Codex CLI on macOS, ps, pgrep, top, lsof and any libproc-backed process query fail with sysmon request failed with error: sysmond service not found / Cannot get process list. The Seatbelt profile generated by Codex doesn't allow mach-lookup of com.apple.sysmond.system, which is what libproc uses for process inspection.

There is currently no documented config.toml knob in Codex CLI 0.131.0 to whitelist this specific mach service or to mark read-only process-inspection commands as trusted. The only escape is sandbox_mode = "danger-full-access", which removes all file/network protections — not a viable trade for the use case.

Reproducer

# Environment:
# macOS Darwin 25.3 (Apple Silicon)
# Codex CLI 0.131.0
# ~/.codex/config.toml:
#   sandbox_mode = "workspace-write"
#   approval_policy = "never"
#   default_permissions = "secret-fence"
#   [permissions.secret-fence.filesystem]
#   ":root" = "read"
#   "/Users/<you>/.mcp-creds/**" = "none"
#   "/Users/<you>/.ssh/**"       = "none"

# Inside a Codex session, ask it to run:
pgrep -fl workspace-mcp
ps -ax | head

# Result:
sysmon request failed with error: sysmond service not found
pgrep: Cannot get process list

lsof still works (it does not depend on sysmond), and live MCP tool calls work — but anything libproc-backed is dead.

Root cause

Confirmed from upstream source:

  • seatbelt_base_policy.sbpl (compiled in via include_str!) does not include (allow mach-lookup (global-name "com.apple.sysmond.system")).
  • seatbelt.rs assembles the profile programmatically and passes it to /usr/bin/sandbox-exec -p <profile>. The profile is not written to disk, so end users cannot patch it without forking and rebuilding Codex CLI.
  • The published Seatbelt mach allowlists do include services like com.apple.SecurityServer, com.apple.networkd, and com.apple.trustd.agent — but not com.apple.sysmond.system.

Use case

Cross-tool diagnostic sessions on macOS where I have both Codex and Claude Code running concurrently, with multiple MCP servers per tool. I needed to verify which tool owned which workspace-mcp child process during a v1.14.1 → v1.21.0 migration. pgrep -fl workspace-mcp is the natural way to do that. Falling back to Claude Code worked, but having to switch tools mid-investigation breaks the workflow.

These commands (ps, pgrep, lsof, top) are read-only — they don't modify state, write files, or exfiltrate secrets beyond a process listing. They're commonly needed during any non-trivial debugging session.

Proposed direction

Two options that would unblock the use case while preserving least-privilege posture:

  1. Add a curated default allow for the small set of mach services that read-only process inspection needs (com.apple.sysmond.system is the load-bearing one for ps/pgrep/top). These are read-only, well-understood, and required for any meaningful debugging.

  2. Or expose a config.toml key for user-defined mach-lookup allowlists, e.g.:

    [sandbox.macos]
    allow_mach_lookups = ["com.apple.sysmond.system"]

    so users can opt in without disabling the rest of the sandbox.

Option 1 is cleaner. Option 2 is more general but introduces configuration surface.

Neither path requires loosening any file/network restrictions — secret-fence filesystem deny rules would continue to apply unchanged.

Verification plan once a fix lands

codex --version  # confirm fix released
pgrep -fl workspace-mcp   # should succeed
ps -axo pid,ppid,command | head  # should succeed
lsof -nP -iTCP -sTCP:LISTEN | head  # should succeed

# Confirm file fences still enforced:
touch ~/.mcp-creds/sandbox-test  # should fail (denied)
ls ~/.ssh                         # should fail (denied)

Related

  • #22405 — same sandbox class (macOS Seatbelt blocking a different syscall, os.sysconf("SC_SEM_NSEMS_MAX")). Both point at the same underlying gap: Seatbelt profile is too restrictive for legitimate read-only system calls and is not user-configurable.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING