0

I'd like to know if there's a way (maybe in .bash_profile?) to prevent the creation of any child processes with names matching a regex. In particular, examining output from ps -ax I am finding extra processes started by tools that I use, which I do not want to be created. I'm using a mac running os 10.14 mojave.

I'm not looking for post-fixes such as killall or pkill -f my_pattern which kills all processes matching regex 'my_pattern' as described here. I also realize that the "right" way to do this is likely to be fixing this at the application level. Probably doable, but not what I'm asking about. Thanks!


  • 1
    Definitely not through bash commands. You could likely get what you're describing by replacing libc (via DYLD_LIBRARY_PATH) to swap out the `exec` functions with your own C implementations. Is that the kind of solution you're looking for? This wouldn't prevent the creation of child processes with certain names (child processes set their names after they're created, and can change their names whenever they want), but it probably matches what you're describing. – Rob Napier Dec 04 '18 at 19:37
  • I don't know about on Mac, but on Linux, using a fake libc to intercept library calls is not officially supported. It may work for a few years, but it's not supported so it may break without warning. – Robin Green Dec 04 '18 at 22:28

0 Answers0