MacOS – Kill all non-essential processes

macos

I'm looking for a utility that will allow me to kill all processes that aren't essential to maintaining system stability in an efficient manner. I'm guessing the easiest way to do this would be to find out which processes are owned by Apple Inc. and exclude them from a kill list, if possible.

Disabling login items is not an option as certain processes are needed at startup, such as a few different cloud services which synchronise files. Killing them on demand would be ideal.

Below is an example of what should be killed.

An example of what should be killed

Best Answer

The processes you mention would all be killed by one command:

kill -9 -1

That would also log you out and kill all the programs you run so it's not ideal, but it would speed up your Mac and dedicate all further memory and resources to the system.

Practically, you would need to use launchctl to list all user tasks and quit them one by one. The tasks you mention all get started when you log in, so killing them might not do anything but cause them to exit, and re-start.

I would recommend instead of killing - doing the work to really measure the aspect of the system that's causing you constraint. RAM, CPU, Network, disk IO and focus on apps that impact that. The CPU times of the tasks you mentioned are so trivially small, it's hard to see them as any sort of problem, but perhaps you have data and measurements showing otherwise.

OS X can run thousands of small processes and juggle memory, and it's a rare instance where one program has a large enough memory leak or doesn't idle when it's not in use that it's unlikely you have a problem that doing all the work to script a kill tool would ever make you back the time you spent on it. I'd say, work on that script if you need it to learn how things work and not to make any difference going forward. In this instance, don't solve the general problem is my advice...

enter image description here