A MacOS port of reptyr
Reptyr is a tool that lets you reparent a running program to a new terminal. For example, if you have a Slurm job running but you forgot to run it on a tmux pane, ur screwed. Reptyr helps sidestep this by letting you 'move' the terminal process into a tmux session, allowing you to detach safely. Codex and other agents often don't run things on tmux by default, and by the time i often remember to remind it, it's already running. This would be useful there!
Now as to why I dont vibecode this by myself, explained by Claude:
reptyr's core trick is two things Linux makes easy and macOS makes awkward:
Arbitrary process introspection via /proc — reptyr uses /proc/
/fd to find a process's file descriptors and /proc/ /mem (or PEEKTEXT/POKETEXT) to read/write its memory. macOS has no /proc. You'd need to rebuild this via proc_pidinfo, proc_pidfdinfo, and Mach APIs like task_for_pid + vm_read/vm_write — a fundamentally different, less-documented, and more permission-gated API surface (task_for_pid in particular is heavily restricted by SIP/entitlements on modern macOS, which is a real blocker, not just an inconvenience).
ptrace-based syscall injection to redirect the controlling TTY — reptyr injects code into the target process to make it call ioctl(TIOCSCTTY) on the new pty. macOS's ptrace is a stripped-down BSD-derived version that doesn't support the same memory read/write or syscall-injection tricks reptyr relies on; you'd likely need to do this through Mach thread/task manipulation instead.
TLDR, it isn't something Claude can one-shot just yet, which partly makes it a hard and interesting problem to solve. IMO, if I were an Apple hiring manager, this is exactly the kind of project I'd want to see, rather than another Next.js CRUD box. Again, I doubt my boss would appreciate me doing this rather than working on conformational models just yet, so I don't have the bandwidth, but if someone's working on this or is inspired to land an Apple 2027 swe intern, lmk if you end up doing this! :)