MacOS – How to manually control processes launched on start

hanglaunchdmacosperformance

Every time my Mac starts, about ~210 processes are launched, requiring about ~1000 OS Threads. With every Apple update this number increases. My laptop freezes for 1-3 min a couple of times per week because some process I've never heard of starts consuming 100% of CPU time till they likely crash. From googling process names the Apple process launch policy on laptops with limited battery life seems to be: launch every time everything for anything anyone might ever want to do.

  • Is there a way to do something about this?

What I've found:

  • Some of the processes are started by root (I don't want to do much about those).

  • However, most of them are started by my user, and most of those are for things that I do not need or that I have explicitly disabled in system preferences (keychain, messenger…).

I guess launchd is in charge of starting all these processes. I've found /Library/LaunchAgents and /Library/LaunchDaemons but these are just a small fraction of the processes that get launched, and none of them are system processes.

  • If they are all launched by launchd is there a configuration file for startup processes somewhere?

Note: I don't mind at all that a process gets launched when I do something that requires it. It is just that I find 200 processes, most of them for things I don't always need and a lot of them for things I've explicitly disabled, to be just nuts.

Update:

It seems that sudo launchctl list is a good place to start, one can then use launchctl load <service> and launchctl remove <service> to load/remove services. It would be nice to get a list of which services are safe to remove, and which services should never ever need to be removed, gonna experiment with that.

Best Answer

~200 processes seems a tad high, but not out of range for *nix systems depending on the hardware and services being invoked. Managing the things that you've installed through the LaunchAgents and LaunchDaemons is the best plan that won't kill your system. Digging into services invoked by launchd is not something I'd recommend unless you understand what the process is there for and what it does - some launchd processes are inter-related and killing one can cause another to fail, and you're heading to a broken system.

For the "freezing" problem, find the service(s) that are suddenly spiking their CPU usage and do some Google searching, note what apps you have open at that time, read the Console logs and see if you can narrow down the cause. Fixing problems like that takes a scalpel, not a shotgun.