PTY/file-descriptor leak in Claude desktop app exhausts all system pseudo-terminals (posix_openpt → ENXIO)
Summary
After a long-running session, the Claude desktop app accumulates pseudo-terminal
(PTY) master file descriptors without releasing them. It eventually holds all
PTYs allowed by the kernel, after which no process on the machine can open a new
terminal — VS Code, iTerm, Terminal, etc. all fail with:
The terminal process failed to launch: A native exception occurred during
launch (posix_openpt failed: Device not configured) // ENXIO
Environment
- Claude.app 1.12603.1
- macOS 26.5.1 (build 25F80), arm64
kern.tty.ptmx_max= 511
Evidence (collected live)
lsof /dev/ptmx→ a single PID (/Applications/Claude.app/Contents/MacOS/Claude)
holds 511 ptmx master fds == the entire system limit.
- That process has only 11 live child processes, yet holds 511 PTY masters →
~500 masters are orphaned (child already exited, master fd never closed).
- App uptime at time of capture: ~37h. The fd count grows monotonically with the
number of shell/agent commands executed and never drops.
Diagnosis
PTY master fds are not disposed/closed on child-process exit (node-pty–style leak).
They accumulate until hitting the kernel ceiling (511), at which pointposix_openpt() returns ENXIO system-wide.
Reproduce
- Keep the desktop app running for a long session.
- Execute many shell commands / agent tool calls.
- Watch the count climb and not recover:
lsof /dev/ptmx | awk 'NR>1{print $2}' | sort | uniq -c | sort -rn
- Once it reaches
sysctl kern.tty.ptmx_max, all new terminals fail with ENXIO.
Workaround
Quit (Cmd+Q) and relaunch the app — releases all leaked PTYs instantly.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗