Desktop app leaks PTY masters until system PTY limit (511) is exhausted — Terminal fails with 'forkpty: Device not configured'
Summary
The Claude desktop app (/Applications/Claude.app) leaks pseudo-terminal (PTY) master file descriptors over its runtime. After ~1.5 days of uptime a single app process held 506 of the system's 511 available PTYs (kern.tty.ptmx_max = 511). Once the limit is reached, no other application can open a PTY — opening Terminal.app fails immediately with:
[forkpty: Device not configured]
[Could not create a new process and open a pseudo-tty.]
This makes the whole machine's terminal usage unusable until the Claude app is quit, even though the OS itself is healthy (plenty of disk, /dev/ptmx present, devfs mounted, process/file limits fine).
Environment
- Claude desktop app: 1.14271.0
- Claude Code (bundled): 2.1.181
- macOS: 26.2 (25C56), Apple Silicon
kern.tty.ptmx_max: 511 (macOS default)
Evidence
App process (PID 679) had been running ~34h:
$ ps -o lstart=,etime= -p 679
Sun Jun 21 11:37:25 2026 01-09:57:48
It alone held 506 PTY masters:
$ lsof /dev/ptmx | awk 'NR>1{print $1,$2}' | sort | uniq -c | sort -rn | head
506 Claude 679
5 Code\x20H 1147
1 COMMAND
$ lsof -p 679 | grep -c /dev/ptmx
506
Slave device nodes were exhausted up to the limit:
$ ls /dev/ttys* | wc -l
527
All other system health checks were clean:
- Disk: 60 GB free
/dev/ptmx:crw-rw-rw- root ttypresent- devfs mounted on
/dev kern.maxproc 4000,kern.maxfiles 122880— far from limits
Impact
- Every new PTY consumer on the machine fails: Terminal, iTerm, tmux,
script, IDE integrated terminals, SSH-t, etc. - Presents as a scary, opaque system error (
forkpty: Device not configured) that gives no hint the Claude app is responsible. - Only workaround is to fully quit (
Cmd+Q) and relaunch the Claude app, which releases all leaked PTYs at once.
Expected behavior
PTY master FDs spawned for terminal/MCP/sub-sessions should be closed when those sessions end, so the count stays bounded over long app uptimes rather than growing monotonically toward the 511 ceiling.
Reproduction (likely)
- Keep the Claude desktop app running for an extended period (~1+ days) with normal Claude Code / terminal / MCP usage.
- Observe
lsof -p <Claude PID> | grep -c /dev/ptmxgrowing over time and not dropping when sessions close. - Once it nears 511, opening Terminal.app fails with
forkpty: Device not configured.
Notes
Possible mitigation on the user side (non-persistent, does not fix the leak): sudo sysctl -w kern.tty.ptmx_max=2048. Real fix is releasing the PTY masters when their sessions end.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗