---
title: "Comment by Apps by Mo on \"pkill -f cat quits every app on a Mac, and coding agents keep running it\" | Hashnode"
description: "This exact one hit me on 25 October. An agent cleaning up after a build ran pkill -f “cat” and every menu bar app I had open quit, along with a long job in anot"
url: "https://hashnode.com/posts/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it/6af57f79de1309ac2b76f679/comment/6af5bc3fec18926cf0d16c87"
---

[Discussion](https://hashnode.com/posts/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it/6af57f79de1309ac2b76f679)

Comment [pkill -f cat quits every app on a Mac, and coding agents keep running it](https://hashnode.com/posts/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it/6af57f79de1309ac2b76f679)

[Apps by Mo](https://hashnode.com/@appsbymo)

[14h ago](https://hashnode.com/posts/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it/6af57f79de1309ac2b76f679/comment/6af5bc3fec18926cf0d16c87)

This exact one hit me on 25 October. An agent cleaning up after a build ran pkill -f “cat” and every menu bar app I had open quit, along with a long job in another app and the agent itself. What has held since: every brief I give an agent that runs background jobs says “stop only by the PID you saved from $!”, and it may never quit anything it did not start. For putting things back, open -g -a relaunches each app without stealing focus, and pgrep -x confirms it is up. The option-order point is new to me, thanks for measuring it.

[Myeongseok Kang](https://hashnode.com/@dooly6276)

[13h ago](https://hashnode.com/posts/pkill-f-cat-quits-every-app-on-a-mac-and-coding-agents-keep-running-it/6af57f79de1309ac2b76f679/comment/6af5bc3fec18926cf0d16c87#reply-6af5cad61942362d106e68f1)

Thanks for writing this up. The agent quitting along with everything else is the worst part of it, because then nothing is left to say what happened. "Stop only the PID you saved from $!" is the same rule the hook falls back to, and it is good to hear it holds in a written brief too, with nothing enforcing it. open -g -a to put the apps back without stealing focus, then pgrep -x to check, is a useful recovery step.
