5

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

  • 1
    why do you want to do this? – dwightk Feb 4 '15 at 21:05
  • To reduce log activity, power, CPU and memory usage on the system when I'm leaving it on overnight for network services. The Activity Monitor requires me to go through each process, a tedious task when I want the system running its factory default processes and nothing more. – abestic9 Feb 4 '15 at 21:13
  • 1
    Wouldn't logging out (and then back in if needed) accomplish the same thing? – john Feb 4 '15 at 21:41
  • The tasks I've highlighted in the screenshot are launched on login, so logging out and in again would only end the processes I've launched since then. – abestic9 Feb 4 '15 at 22:03
  • 2
    Do you need to be logged in over night at all? Stopping and starting these processes seems to be quite a hassle, and the OS will put them to sleep anyway if you are no longer actively using the computer. – nohillside Feb 4 '15 at 22:10
5

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

  • 2
    This comic, without the accompanying alt text, gives the exact opposite idea of what it is meant to. The alt text reads “I find that when someone's taking time to do something right in the present, they're a perfectionist with no ability to prioritize, whereas when someone took time to do something right in the past, they're a master artisan of great foresight.” so while the comic itself takes a jab at the practice, the alt text recognises virtues of this approach. They shouldn’t be presented separately. – user137369 Oct 8 '15 at 16:49
  • @user137369 You raise excellent points about alt text. However, alt text doesn't work on iOS so I figured I'd link back to the original - the point I was making was to reinforce that as an academic exercise, I support trying to make your own kill list but that the effort would never save time in the end... – bmike Oct 8 '15 at 16:52
  • Regarding alt text not working in certain devices, you need only precede the url with m.. In this case, m.xkcd.com/974. – user137369 Oct 8 '15 at 16:56
  • On another note, why not use -3 instead of -9? Isn’t -9 for extreme cases? There aren’t hanged processes, here. – user137369 Oct 8 '15 at 16:58
  • 1
    One password extension doesn't obey the -3 or QUIT signal as most menu bar, utility and programs that are designed to run under launchd catch and ignore that signal. The -9 is a non-catchable, non-ignorable kill. It is extreme and non-ideal. – bmike Oct 8 '15 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .