Cursor PTY Exhaustion Causing Terminal Failures (macOS)

I hit a terminal failure in Cursor that looked like:

  • Error initializing PTY: posix_spawnp failed
  • Turbo/Next runs failing with:
    • failed to openpty: Os { code: 6, message: “Device not configured” }
  • Sometimes also seeing:
    • OSError: out of pty devices

Impact

  • Integrated terminal became unstable / closed.
  • pnpm dev failed before app code started.
  • Eventually reproduced in regular Terminal too (system-wide PTY exhaustion).

Root Cause

Cursor had leaked a large number of orphan terminal helper processes:

  • cursor-shell processes with ppid=1 (orphaned)
  • In my case: 254 orphaned cursor-shell processes
  • Each held a PTY, exhausting available PTYs on macOS

How I Confirmed It

  • PTY allocation test failed:

    python3 -c 'import pty; pty.openpty()' → OSError: out of pty devices
    
  • Process check showed many cursor-shell instances:

    ps -ax -o pid=,ppid=,comm= | awk '$3=="cursor-shell" && $2==1 {print $1}'
    

Fix (worked immediately)

Kill orphaned cursor-shell processes:

ps -ax -o pid=,ppid=,comm= | awk '$3=="cursor-shell" && $2==1 {print $1}' | xargs -n 50 kill

After cleanup:

  • cursor-shell count dropped to 0
  • PTY allocation worked again:
    python3 -c 'import pty; m,s=pty.openpty(); print("openpty ok", m, s)'
    
  • pnpm dev could start normally again

Notes

  • This appears to be a Cursor terminal process leak, not a project code issue.
  • Restarting Cursor helps, but once PTYs are exhausted, killing orphaned cursor-shell processes is the reliable recovery step.
  • Reference doc for related terminal failures: VS Code terminal launch troubleshooting

Hi there!

We detected that this may be a bug report, so we’ve moved your post to the Bug Reports category.

To help us investigate and fix this faster, could you edit your original post to include the details from the template below?

Bug Report Template - Click to expand

Where does the bug appear (feature/product)?

  • Cursor IDE
  • Cursor CLI
  • Background Agent (GitHub, Slack, Web, Linear)
  • BugBot
  • Somewhere else…

Describe the Bug
A clear and concise description of what the bug is.


Steps to Reproduce
How can you reproduce this bug? We have a much better chance at fixing issues if we can reproduce them!


Expected Behavior
What is meant to happen here that isn’t working correctly?


Screenshots / Screen Recordings
If applicable, attach images or videos (.jpg, .png, .gif, .mp4, .mov)


Operating System

  • Windows 10/11
  • MacOS
  • Linux

Version Information

  • For Cursor IDE: Menu → About Cursor → Copy
  • For Cursor CLI: Run agent about in your terminal
IDE:
Version: 2.xx.x
VSCode Version: 1.105.1
Commit: ......

CLI:
CLI Version 2026.01.17-d239e66

For AI issues: which model did you use?
Model name (e.g., Sonnet 4, Tab…)


For AI issues: add Request ID with privacy disabled
Request ID: f9a7046a-279b-47e5-ab48-6e8dc12daba1
For Background Agent issues, also post the ID: bc-…


Additional Information
Add any other context about the problem here.


Does this stop you from using Cursor?

  • Yes - Cursor is unusable
  • Sometimes - I can sometimes use Cursor
  • No - Cursor works, but with this issue

The more details you provide, the easier it is for us to reproduce and fix the issue. Thanks!