codex - 💡(How to fix) Fix macOS SSH remote sessions fail AGENTS.md discovery with Operation not permitted

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…

Error Message

error: unexpected argument '--json' found

Usage: codex [OPTIONS] [PROMPT] codex [OPTIONS] <COMMAND> [ARGS]

Root Cause

Codex remote configured through SSH cannot read into normal macOS user workspace directories because macOS TCC blocks file traversal. The visible failure in Codex's app-server log is during AGENTS.md discovery:

Code Example

ProductName:    macOS
ProductVersion: 26.5
BuildVersion:   25F71

uname -mprs:
Darwin 25.5.0 arm64 arm

---

/opt/homebrew/bin/codex app-server --listen unix://
sshd-session: skyline23@notty
nc -U /Users/skyline23/.codex/app-server-control/app-server-control.sock

---

/opt/homebrew/bin/codex app-server --listen unix://

---

error: unexpected argument '--json' found

Usage: codex [OPTIONS] [PROMPT]
       codex [OPTIONS] <COMMAND> [ARGS]

---

codex_core::agents_md: error trying to find AGENTS.md docs: Operation not permitted (os error 1)

---

/Users/skyline23/.codex/app-server-control/app-server.log

---

/Users/skyline23/Downloads/Lumen
/Users/skyline23/Documents/Codex/2026-05-15/...

---

/opt/homebrew/bin/codex -> /opt/homebrew/Caskroom/codex/0.130.0/codex-aarch64-apple-darwin

---

/opt/homebrew/bin/codex app-server --listen unix://

---

sshd-session: <user>@notty
   nc -U /Users/<user>/.codex/app-server-control/app-server-control.sock

---

/Users/<user>/Downloads/<repo>
   /Users/<user>/Documents/Codex/<workspace>

---

codex_core::agents_md: error trying to find AGENTS.md docs: Operation not permitted (os error 1)

---

/opt/homebrew/bin/codex -> /opt/homebrew/Caskroom/codex/0.130.0/codex-aarch64-apple-darwin
/opt/homebrew/bin/codex app-server --listen unix://
/Users/skyline23/.codex/app-server-control/app-server-control.sock

/usr/sbin/sshd
/usr/libexec/sshd-session
/usr/libexec/sshd-keygen-wrapper
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

codex-cli 0.130.0

What subscription do you have?

ChatGPT Pro

Which model were you using?

Not model-specific. The failure happens during remote/SSH app-server session startup before normal task execution.

What platform is your computer?

ProductName:    macOS
ProductVersion: 26.5
BuildVersion:   25F71

uname -mprs:
Darwin 25.5.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

SSH/headless remote connection into macOS. The relevant local processes were sshd-session plus a Homebrew Codex CLI app-server.

Observed process shape:

/opt/homebrew/bin/codex app-server --listen unix://
sshd-session: skyline23@notty
nc -U /Users/skyline23/.codex/app-server-control/app-server-control.sock

At the time of collecting diagnostics, the remote notty session had disconnected, but the app-server was still running:

/opt/homebrew/bin/codex app-server --listen unix://

Codex doctor report

Not available in this CLI version:

error: unexpected argument '--json' found

Usage: codex [OPTIONS] [PROMPT]
       codex [OPTIONS] <COMMAND> [ARGS]

What issue are you seeing?

Codex remote configured through SSH cannot read into normal macOS user workspace directories because macOS TCC blocks file traversal. The visible failure in Codex's app-server log is during AGENTS.md discovery:

codex_core::agents_md: error trying to find AGENTS.md docs: Operation not permitted (os error 1)

The log file checked was:

/Users/skyline23/.codex/app-server-control/app-server.log

The affected workspaces were under TCC-protected user folders such as:

/Users/skyline23/Downloads/Lumen
/Users/skyline23/Documents/Codex/2026-05-15/...

This is confusing for remote SSH usage because the user connected to the host over SSH and expected CLI access to behave like a normal shell. Instead, Codex fails internally while looking for AGENTS.md, with no actionable message explaining that macOS Full Disk Access/TCC is the likely cause or which executable needs to be granted access.

What steps can reproduce the bug?

  1. On macOS 26.5, install Codex CLI through Homebrew so that the executable resolves like this:

    /opt/homebrew/bin/codex -> /opt/homebrew/Caskroom/codex/0.130.0/codex-aarch64-apple-darwin
  2. Configure Codex remote access through SSH.

  3. Start the Codex app-server used by remote control:

    /opt/homebrew/bin/codex app-server --listen unix://
  4. Connect remotely over SSH. The observed connection path used:

    sshd-session: <user>@notty
    nc -U /Users/<user>/.codex/app-server-control/app-server-control.sock
  5. Start or resume a Codex session whose workspace is under a macOS TCC-protected folder, for example:

    /Users/<user>/Downloads/<repo>
    /Users/<user>/Documents/Codex/<workspace>
  6. Codex attempts to discover AGENTS.md and logs:

    codex_core::agents_md: error trying to find AGENTS.md docs: Operation not permitted (os error 1)

What is the expected behavior?

Codex remote over SSH should be able to start the session and read the configured workspace, including AGENTS.md, without failing with Operation not permitted.

Additional information

Host and process details collected during debugging:

/opt/homebrew/bin/codex -> /opt/homebrew/Caskroom/codex/0.130.0/codex-aarch64-apple-darwin
/opt/homebrew/bin/codex app-server --listen unix://
/Users/skyline23/.codex/app-server-control/app-server-control.sock

/usr/sbin/sshd
/usr/libexec/sshd-session
/usr/libexec/sshd-keygen-wrapper

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