Skip to content
86% off$349 $48.86code BF2026

Guides

Codex sandbox error "command was killed by a signal" on Mac

Codex CLI on a Mac fails with "sandbox error: command was killed by a signal"? Test your login shell profile, then the sandbox and approval settings.

TroubleshootingUpdated 7 min read

On this page

You ask Codex to read a file on your Mac and get this, again and again:

text
sandbox error: command was killed by a signal

Logging out, reinstalling and switching models didn't help. People on a Reddit coding forum report the same error in the CLI and in the Cursor and Windsurf extensions, so the cause is usually on your machine, not in your account or the model. That thread is from August 2025, so check the steps against your current Codex version.

Why it happens

The error text means the process Codex launched died from a signal before it returned output. Codex doesn't say which signal or which process. Two causes were reported, and a third is worth ruling out.

1. A shell startup file kills the shell. Codex runs its commands through a shell. If that shell reads a startup file that exits early, crashes or starts something that gets killed, the command dies before it does any work. We can't confirm which shell or flags your Codex version uses, so the checks below test both bash and zsh.

2. The sandbox blocks something. On macOS, Codex uses Seatbelt, Apple's kernel-enforced sandboxing mechanism. Codex invokes Seatbelt through macOS's /usr/bin/sandbox-exec command. OpenAI's page on running Codex safely says the sandbox defines the technical execution boundary (where Codex can write, whether it can reach the network, which paths stay protected), while the approval policy determines when Codex must ask to act outside it. People report that a command the sandbox won't allow can surface as "killed by a signal" instead of a clear denial. We found no OpenAI documentation of that mapping, so treat it as an observation, not a documented behavior.

3. Leftover configuration or an old version. A stale setting in ~/.codex/config.toml, or an older CLI build, can produce odd behavior. This is the least likely cause, but the checks are quick.

CauseTypical symptomFix
Bad login profilebash -lc "echo hello" prints nothing or errorsFix or guard the startup file
Sandbox restrictionShell test passes, reads still fail inside CodexUse an approval mode that asks, approve once
Stale config or old CLIStarted after an update or a config editReview config.toml, update Codex
Editor launch differencesWorks in Terminal, fails in the extensionLaunch Codex from Terminal, compare

Fix 1: Test your login shell profile

  1. Open Terminal and run:

    bash
    bash -lc "echo hello"; echo "exit status: $?"

    This starts a non-interactive login shell, runs one command and prints the exit status.

  2. If you see hello and exit status: 0, bash is fine. Go to step 6 for zsh.

  3. If you see an error, no hello, or a status above 128, a startup file is the likely culprit. A status above 128 means a signal killed the shell: 137 is SIGKILL and 143 is SIGTERM (128 plus the signal number).

  4. Confirm by skipping all startup files:

    bash
    bash --noprofile --norc -c "echo hello"

    If this prints hello but step 1 didn't, one of your startup files is at fault.

  5. Find the file. A bash login shell reads /etc/profile, then only the first of ~/.bash_profile, ~/.bash_login and ~/.profile that exists. List which of yours exist:

    bash
    ls -a ~ | grep -E '^\.(bash_profile|bash_login|profile)$'

    Rename the first one out of the way, test, and rename it back. This example uses ~/.bash_profile; run it only if that file exists:

    bash
    mv ~/.bash_profile ~/.bash_profile.off
    bash -lc "echo hello"
    mv ~/.bash_profile.off ~/.bash_profile

    If hello now prints, open the file and look for lines that call exit or kill, start another shell or a terminal multiplexer, or run something that expects an interactive terminal. Remove those lines or guard them so they only run in interactive shells, then rerun step 1.

  6. macOS defaults to zsh, so run the same test there:

    bash
    zsh -lc "echo hello"; echo "exit status: $?"

    If it fails, check ~/.zshenv, ~/.zprofile and ~/.zlogin the same way. ~/.zshenv is read by every zsh invocation, so a bad line there breaks more than login shells.

Fix 2: Use an approval mode that asks before leaving the sandbox

If both shell tests pass and file reads still fail inside Codex, the sandbox is the next suspect. One reply in the original report said that starting Codex with --full-auto made it ask whether to run the command outside the sandbox. Try:

bash
codex --full-auto

Flags and mode names have changed between Codex versions. OpenAI's older CLI getting-started article lists the flags --suggest, --auto-edit and --full-auto, and describes Full Auto as running inside a sandboxed, network-disabled environment scoped to the current directory. A later OpenAI post says approval modes were simplified to three levels: read-only with explicit approvals, auto with full workspace access but approvals outside the workspace, and full access. Run codex --help to see which flags your install accepts. OpenAI's Codex CLI documentation is the place to confirm current options.

Two more things to check:

  • Work inside the project folder. OpenAI's older help article advises that if you use Full Auto, you should confirm the sandbox has permission to access required directories. If you point Codex at a file outside the folder you launched it in, expect the sandbox to get in the way.
  • Look at ~/.codex/config.toml. OpenAI's help center mentions a restrictive setup with sandbox_mode = "read-only" and approval_policy = "on-request", and says to restart Codex after updating your configuration. If you or a team profile set stricter values earlier, comment them out and restart Codex to see whether the error changes. Keep a copy of the file; don't delete it.

If you want to test the sandbox on its own, run codex sandbox --help to see whether your version has a sandbox test command and how it is called. We couldn't confirm its syntax, so rely on the help output. If a plain ls fails there too, the problem is the sandbox or your system, not the model.

Fix 3: Rule out the editor and an old install

  1. Run Codex from Terminal. If it works there but fails in the Cursor or Windsurf extension, the difference is in how the editor launches it (its environment and shell). If it fails in both, focus on the shell and sandbox.
  2. Open a new Terminal window. Edits to a startup file only apply to new shells.
  3. Check the version. Run codex --version, then update the way you installed it (npm or Homebrew). Codex ships often, and an older build may carry a bug that's already fixed.
  4. Try a small test folder under your home directory with a single text file. If reads work there but not in your project, the project's location or permissions are the issue.
  5. Check for a second install. Run which -a codex. Two copies on your PATH can mean you update one and run the other.

Checklist before you try again

  • bash -lc "echo hello" prints hello with status 0.
  • zsh -lc "echo hello" prints hello with status 0.
  • You launched Codex from inside the project folder, in a fresh Terminal window.
  • codex --version shows a current release.
  • ~/.codex/config.toml has no stricter sandbox or approval settings than you intended.
  • You've tried an approval mode that asks, and read each prompt before approving.

If nothing works

Report it to OpenAI through the Codex CLI repository or OpenAI's help center. Include the exact error text, your macOS version, codex --version, whether you ran it in Terminal or an editor extension, the output of both shell tests with exit statuses, and the exact command and flags you used to start Codex.

text
Codex CLI on macOS fails on every file read with:
"sandbox error: command was killed by a signal"

macOS version: (your version)
codex --version: (output)
Launched from: Terminal / Cursor / Windsurf
Start command and flags: (for example, codex --full-auto)

Already tried:
- bash -lc "echo hello": (result and exit status)
- zsh -lc "echo hello": (result and exit status)
- Logged out, reinstalled, changed model
- Fresh Terminal window, small test folder

The error happens on [every read / only in one project].

Common questions

Is the sandbox error the same as a permission denied error?

Not exactly. A denial usually names the file or operation. This message only says the process was killed by a signal, which is why checking the shell startup files comes first.

Is it safe to run Codex with full access to skip the problem?

It removes the guardrails, so only do it as a short test in a folder you trust. OpenAI's write-up on the Windows sandbox describes full access as letting Codex run all commands without approval or restrictions, which removes friction at the expense of oversight.

Why did it break after I changed my shell setup?

A new line in ~/.zshenv, ~/.zprofile or ~/.bash_profile (a version manager, a prompt tool, a tmux auto-start) can make non-interactive shells exit. Undo your last change and rerun the tests above.

Does reinstalling Codex help?

Usually not, because the failing piece is your shell startup files or the sandbox rules, neither of which a reinstall touches.

Every app.
One purchase.