macOS: Codex Desktop/app-server appears to exhaust syspolicyd, causing spctl “Too many open files” globally
Summary
On macOS 26.2, after running Codex Desktop for a while, Gatekeeper/SystemPolicy enters a broken state where spctl returns Too many open files for every assessed path, including /bin/ls, /tmp, newly-created text files, zip files, DMGs, and unrelated apps. Finder then reports unrelated apps/DMGs as "damaged" and suggests moving them to Trash.
This looks related to existing syspolicyd/Gatekeeper issues, but I am filing a new issue because it reproduces on Codex Desktop 26.608.12217 and local diagnostics point specifically at /Applications/Codex.app/Contents/Resources/codex / app-server / temporary codex-execve-wrapper paths rather than a single downloaded app.
Related issues: openai/codex#25243, openai/codex#25882, openai/codex#26869.
Environment
- macOS: 26.2, build
25C56 - Architecture: Apple Silicon / arm64e
- Hardware model from diagnostics:
MacBookPro18,2 - Codex Desktop:
26.608.12217(CFBundleVersion3722) - Codex binary being diagnosed:
/Applications/Codex.app/Contents/Resources/codex - SIP: enabled
- Gatekeeper assessments: enabled
User-visible symptoms
- Freshly downloaded DMGs show the macOS dialog:
"<file>.dmg" is damaged and can't be opened. You should move it to the Trash. - Existing apps show the same kind of "damaged" dialog.
- The affected files are not actually corrupt. Example: a Royal TSX DMG verified successfully with
hdiutil verify, andcodesignreported a valid Developer ID signature and stapled notarization ticket.
Local diagnostics
spctl fails globally once the system is in this state:
$ spctl --assess --type execute --verbose=4 /bin/ls
/bin/ls: Too many open files
$ spctl --assess --type open --context context:primary-signature --verbose=4 ~/Downloads/royaltsx_5.0.4.1000.dmg
~/Downloads/royaltsx_5.0.4.1000.dmg: Too many open files
$ spctl --assess --type open --context context:primary-signature --verbose=4 /tmp/plain.txt
/tmp/plain.txt: Too many open files
This is not global file descriptor exhaustion:
$ sysctl kern.num_files kern.maxfiles kern.maxfilesperproc
kern.num_files: 14048
kern.maxfiles: 491520
kern.maxfilesperproc: 245760
$ ulimit -n
1048575
syspolicyd looked unhealthy when the issue occurred:
$ top -l 1 -pid <syspolicyd-pid> -stats pid,command,cpu,mem,rsize,vsize,threads,time
PID COMMAND %CPU MEM MEM VSIZE #TH TIME
530 syspolicyd 0.0 801M 801M N/A 29 02:24:31
System diagnostics also recorded syspolicyd doing sustained SQLite/WAL writes:
Command: syspolicyd
Path: /usr/libexec/syspolicyd
Event: disk writes
Writes: 2147.49 MB of file backed memory dirtied over 25569 seconds
Heaviest stack: sqlite3_step -> sqlite3VdbeExec -> pagerWalFrames -> unixWrite -> guarded_pwrite_np
Evidence pointing at Codex
There are repeated macOS diagnostic reports for the Codex binary itself:
Command: codex
Path: /Applications/Codex.app/Contents/Resources/codex
Codesigning ID: codex
Team ID: 2DC432GLL2
Event: disk writes
Writes: 2147.49 MB over 1667 seconds
Writes: 8589.93 MB over 3518 seconds
Writes: 8589.94 MB over 6479 seconds
Heaviest stack: ... -> pwrite
Local Codex state also contains many temporary arg0 wrapper entries:
$ find ~/.codex/tmp/arg0 -maxdepth 2 -name codex-execve-wrapper -print | wc -l
15
$ stat -f '%Sm %N -> %Y' -t '%Y-%m-%d %H:%M:%S' ~/.codex/tmp/arg0/codex-arg0*/codex-execve-wrapper
...
2026-06-12 01:54:51 ~/.codex/tmp/arg0/codex-arg0IgknVX/codex-execve-wrapper -> /Applications/Codex.app/Contents/Resources/codex
2026-06-12 01:55:18 ~/.codex/tmp/arg0/codex-arg0wc32Ni/codex-execve-wrapper -> <VS Code extension>/bin/macos-aarch64/codex
2026-06-12 01:57:57 ~/.codex/tmp/arg0/codex-arg0Tmh6By/codex-execve-wrapper -> <npm global codex>/vendor/aarch64-apple-darwin/codex/codex
The wrapper is a symlink to a signed Codex binary:
$ codesign -dv --verbose=2 ~/.codex/tmp/arg0/<one-dir>/codex-execve-wrapper
Executable=/Applications/Codex.app/Contents/Resources/codex
Identifier=codex
Authority=Developer ID Application: OpenAI OpCo, LLC (2DC432GLL2)
TeamIdentifier=2DC432GLL2
Runtime Version=15.5.0
Codex Desktop logs also show very active app-server state around this time, including repeated AppServerConnection entries and repeated warnings like:
[electron-message-handler] No owner repo found for remote task taskId=...
The currently observed process tree includes multiple Codex app-server / node_repl processes. On this machine I did not find evidence that Locked Computer Use was installed as a SecurityAgentPlugin, and SkyComputerUseService was not running during the later inspection, so the strongest local signal is app-server / shell-tool execution / codex-execve-wrapper, not Computer Use specifically.
Expected behavior
Codex Desktop/app-server/tool execution should not drive syspolicyd into a state where spctl globally fails with Too many open files, and unrelated apps/DMGs should not be reported as damaged.
Actual behavior
After Codex has been running for some time, spctl fails for all files with Too many open files, and Finder/Gatekeeper reports unrelated apps and DMGs as damaged.
Workarounds tried / notes
sudo launchctl kickstart -k system/com.apple.security.syspolicydoes not work with SIP enabled:
Could not kickstart service "com.apple.security.syspolicy": 150: Operation not permitted while System Integrity Protection is engaged
- Rebooting clears the state, but the problem recurs.
- Quitting Codex Desktop and killing
syspolicyd/trustdis likely less disruptive than rebooting, but the root cause appears to be Codex repeatedly triggering the condition.
Ask
Could the team investigate whether Codex Desktop/app-server or the temporary ~/.codex/tmp/arg0/.../codex-execve-wrapper mechanism can repeatedly trigger Gatekeeper/SystemPolicy assessment or excessive SystemPolicy DB writes on macOS 26.2?
If there is a narrower diagnostic flag/logging command for app-server/tool execution on macOS, I can collect that output.
10 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I submitted related in-app feedback with Feedback ID: 019ed2cb-eea6-7851-be4d-8be66a992d92.
My local checks on macOS 26.5.1 build 25F80 showed the same Gatekeeper/SystemPolicy failure family:
spctl --assess --type execute --verbose=4 /bin/lsfailed withinternal error in Code Signing subsystem. The same error also occurred when assessing Codex, Cursor, a normal local Markdown file, and/opt/homebrew/bin/openai.The visible user-facing symptom was macOS showing:
"openai" is damaged and can’t be opened. You should move it to the Trash.The Homebrew OpenAI CLI still ran from Terminal (openai version 1.2.0) and codesign showed it was signed byDeveloper ID Application: OpenAI OpCo, LLC (2DC432GLL2), so this did not look like a corrupted local file. It looked like the same broader SystemPolicy/Gatekeeper broken state described in this issue.Same failure family here on macOS 26.2 (build 25C56), Codex Desktop 26.611.62324, Apple Silicon. I want to add a concrete, fixable root cause that I was able to verify on my machine, because in my case the trigger was not a respawn storm — it was the default
launchctlfile-descriptor limit being far too low for Codex's bundle size.Root cause:
launchctl limit maxfilesdefaults to 256syspolicydis launched bylaunchdand inherits the globallaunchctlmaxfilessoft limit, which on a stock install is just 256:Codex.app ships a very large bundle. On my install it has 7898 Sealed Resources, dominated by an embedded Node runtime:
When Gatekeeper assesses this bundle,
syspolicydopens a large number of files at once and blows past the 256 soft limit, after which every assessment fails with EMFILE globally — exactly the symptoms in this thread (/bin/ls, DMGs, unrelated apps all reported "damaged" /Too many open files). Note the system file table is nowhere near full when this happens:So it is not global FD exhaustion — it's the per-daemon 256 soft cap being too small for a 7898-file bundle.
codesign --verifypasses (it doesn't fan out across all sealed files the same way), which is why the bundle is valid yetspctlfails.Fix that worked for me (and held)
Raising the
launchctllimit and restartingsyspolicydresolved it completely in my case:After this, 5 consecutive
spctl -a /Applications/Codex.appruns all returnedaccepted, Codex and VS Code launched normally, andsyspolicydCPU dropped from ~59% back to ~1%. Crucially, it stayed fixed after launching Codex — re-assessing repeatedly kept passing.To make it survive reboot I added a LaunchDaemon:
Caveat
In my case Codex's main process was stable (single PID, no respawn loop), so raising
maxfileswas a genuine fix. For the reports here where Codex is also doing aposix_spawnstorm of its own GUI binary (#26869 and others), raisingmaxfileswill only delay exhaustion — that part still needs an app-side backoff/retry cap.Suggestions for the Codex team
cua_nodeships ~2755.hheaders and a full bundlednpm(with its ownnode_modules) that aren't needed at runtime. Trimming dev artifacts / archiving JS into asar would drop the sealed-resource count dramatically and ease the pressure onsyspolicyd.launchctl limit maxfilesworkaround for affected macOS users until the bundle is slimmed down.Environment for the record: macOS 26.2 (25C56), Codex 26.611.62324, Apple Silicon, SIP enabled, Gatekeeper enabled.
Update (2026-06-19): My earlier claim that raising
maxfilesto 65536 "fixed it and held" was premature. While it significantly reduces the frequency (from minutes to hours), the underlying issue —codex app-servercontinuously spawning the GUI binary and triggering Gatekeeper assessments without backoff — still causes intermittentsyspolicydCPU churn (saw 159%!) and transient FD spikes. When saturated, syspolicyd fails globally again.Root cause confirmed (matches #16767, #26869):
codex app-server's unbounded posix_spawn + no-cache assessments drive syspolicyd into CPU runaway. Raising maxfiles helps but doesn't fix the app-side bug.Practical mitigation: Quit Codex Desktop (Cmd+Q) when not in use. The CLI (
codex exec) doesn't run app-server persistently. For those keeping it open, I wrote a watchdog that auto-restarts syspolicyd when CPU/RSS spikes: https://github.com/zyzhou9/my-claude-work/tree/master/scriptsApologies for the earlier overconfidence — this is genuinely a tough one to pin down.
Adding another sanitized data point that appears to match this issue exactly.
Environment
Codex.appitself verifies as signed/notarized:User-visible impact
Unrelated apps and DMGs started showing macOS "damaged and can't be opened" dialogs. The affected items were not actually corrupt:
hdiutil verifyreportedchecksum ... is VALID.codesign --verify --deep --strictpassed; signed byTELEGRAM MESSENGER LLP (6N38VWS5BX); notarization ticket stapled.codesign --verify --deep --strictpassed; signed byMicrosoft Corporation (UBF8T346G9); notarization ticket stapled.Yet Gatekeeper/SystemPolicy failed with:
For VS Code Insiders specifically, LaunchServices could spawn/check in the app, then AppleSystemPolicy killed it shortly after:
So the downstream failure was not just a stale Finder dialog. macOS policy enforcement actively killed an unrelated signed/notarized app after launch.
syspolicyd / AppleSystemPolicy evidence
The system-wide file table was not close to full:
Representative unified-log lines:
In one 10-minute sample while Codex Desktop was running, filtered logs counted approximately:
In a later 60-second sample, while the machine was already in the bad state, there were about:
Recovery behavior
syspolicyd, but the issue recurred after Codex Desktop was running again.sudo launchctl kickstart -k system/com.apple.security.syspolicywas blocked by SIP:Notes
This does not look like corruption of Stremio, Telegram, or VS Code Insiders. It looks like Codex Desktop repeatedly triggering macOS SystemPolicy assessment of its own executable/helpers until
syspolicydenters an EMFILE/broken-state condition, after which unrelated signed/notarized apps and DMGs are rejected or killed.A useful product-side mitigation would be a safe mode / feature-disable path that avoids high-risk helper/plugin startup, plus bounded retry/backoff around any path that can trigger repeated policy assessment of
/Applications/Codex.app/Contents/MacOS/Codexorcode_sign_clone/.../Codex.app.bundle/Contents/MacOS/Codex.I hit a very similar failure mode, but in my case the strongest local signal was the Computer Use / SkyComputerUse runtime rather than only
codex-execve-wrapper.Symptoms
syspolicyd/trustdshowed sustained high CPU.spctlreturnedToo many open filesfor otherwise valid apps.Example:
After recovery, the same check returned:
Important observation
Disabling the Computer Use plugin was not sufficient by itself.
I had:
but Codex Desktop still restored a user-level runtime app under:
and it could also write back a
notifyhook pointing to:That means Computer Use can still be invoked indirectly through:
even when the plugin itself appears disabled.
Workaround that stabilized my machine
This is not a product fix, but it stopped the recurrence locally.
notify = [...SkyComputerUseClient..., "turn-ended"]line from~/.codex/config.toml./Applications/Codex.app, since that can break the app signature.syspolicydhad already entered the broken state. Trying to restartcom.apple.security.syspolicydirectly was blocked by SIP.Expected:
SkyComputerUseService/SkyComputerUseClientprocessToo many open filesspctlreturnsacceptedReverting the workaround
If you want to re-enable Computer Use later:
Then re-enable Computer Use from Codex settings/config and restart Codex.
Suggested product-side fix
Codex Desktop should probably not auto-install, auto-restore, launch, or write a
notifyhook for Computer Use when:[features].computer_use = false, or[plugins."computer-use@openai-bundled"].enabled = falseAlso, uninstalling/disabling Computer Use should remove or ignore any
notifyhook that points toSkyComputerUseClient.The key issue here is that the visible plugin state and the actual user-level Computer Use runtime state can diverge. When they diverge,
SkyComputerUseClientmay still be invoked and can contribute to the same global Gatekeeper /syspolicydfailure pattern described in this issue.This is a huge problem and renders codex app unusable on my machine.
I encountered this syspolicyd problem yesterday on a very fresh version:
Version 26.616.71553 • Released Jun 23, 2026
I tried many ways I can find in all comments from all issues I can found but no one works.
Until I found a stray/corrupted .git folder under one of my codex working directory, which contains multiple repos (but it should not have its own .git).
I removed it and everything is fine now.
After open Codex App, syspolicyd will run at ~50% for only couple seconds, not infinitively 150% anymore.
computer use, browsers, etc. are all enabled.
Hope this helps.
Yes, it was caused by empty .git folders from syncthing on my machine. Codex should handle this gracefully without essentially rendering your OS unusable.
Reproduced this today (2026-07-16) via the ChatGPT macOS app (not the standalone Codex.app), which bundles the same
codex app-server. Adding a data point that may help narrow the root cause:Timeline (sampled every 15s):
syspolicydidle at 0-0.3% CPU, no hung processes.syspolicydCPU jumped to 81.4%, 2 new processes stuck at <=128KB RSS (dyld startup stage).brew shellenvinvoked by zsh login startup) got stuck for 4.5 minutes at 32KB RSS, blocking Terminal from presenting a shell prompt at all.New finding - quitting the app is not sufficient:
killall ChatGPT(or quitting normally) only kills the top-level app. Thecodex app-serverprocess (/Applications/ChatGPT.app/Contents/Resources/codex ... app-server --analytics-default-enabled) gets reparented to launchd (PPID becomes 1) and keeps running and keeps spawning newnode_replchildren (observed count grow from 2 to 3 with zero user interaction after the app was quit).syspolicydstayed pegged at ~54% the whole time it was orphaned.Only after manually
kill -9-ing the orphanedapp-serverPID (and its remaining children) didsyspolicydCPU drop to 0% and system-wide process spawn latency return to normal.This suggests the fix needs to cover two things: (1) the exec/validation cost per the analysis in #19885, and (2) proper process-group cleanup on app quit so
app-serverdoesn't outlive its parent as an orphan.