[OS X] High process numbers

Ever experienced high process numbers (20k+) in Finder? That’s probably since some process keeps respawning over and over. Some launchAgents fail to start and launchtcl keeps trying to start them. This is filling your hard disk with logs and keeps your hard disk busy writing, preventing it to spin down.

12-07-12 11:11:25,732 com.apple.launchd: (org.postgresql.postgres[66258]) Exited with code: 1
12-07-12 11:11:25,732 com.apple.launchd: (org.postgresql.postgres) Throttling respawn: Will start in 10 seconds
12-07-12 11:11:34,034 com.apple.launchd: (com.edb.launchd.postgresql-9.1[66265]) getpwnam("postgres") failed

You should probably fix the error that prevents the agent or daemon to start but thats depending on the kind of agent. In my case I didn’t need the agents that were spawning. I didn’t need a PostgreSQL-server and neither the Wiki-server OS X is providing, coming with all kinds of collab* processes. Please proceed only if you don’t need the agent you are going to remove, permanently!

So, how do you stop these annoying little agents? First determine the process-name. Then lookup the launchctl plist files:

$ sudo launchctl list | grep annoyingAgent

You can unload/remove this plist from launchctl by running:

$ sudo launchctl remove 'com.your.annoying.agent.plist'

Please check now that your computer is still functioning. Do this first, as you can return easily until now. Just replace the ‘remove’ with ‘load -w’ to re-add the agent.

When you reboot your machine the processes are sometimes coming back and to permanently disable them run:

$ locate 'com.your.annoying.agent.plist' | while read -r line; do sudo mv $line $line.disabled; done;