soagent, calendaragent, accountsd and callservicesd hogging the CPU

If your Mac is running hot it might be the addressbook and calendar syncing services. This usually happens when Google or Apple aren't responding or aren't accepting the authentication for cloud sync. The easiest thing to do is turn them off under "Internet Accounts" under System Preferences. However, if you want the details to sync between iCloud and Google to your Mac, you have to rebuild these things or re-authenticate. If that is too much of a pain you can use the UNIX command line to pause them.

You can verify this by sorting by CPU usage load in the Activity Monitor as follows. The illustration below shows the CPU load drop when you pause these programs.


Above, you see the CPU load sitting at around 86% until I run the script.

You can either put this script into Crontab or the /etc/rc file or just do a manual run.

Please note that if you run this script it will pause synchronising contacts and addressbook, as well as the icloud system preference/control panel, and may also pause those apps as well since they will hang-up while waiting for server response that doesn't come, due to the back-end synchroniser being paused. So, if you find this, simply re-run the script to enable the back-end synchronisers.

Make a script in a common path e.g. your home folder. Call it say "cpu_hog.sh"

Mark it mode 777 using 

chmod 777 cpu_hog.sh

Put this code inside:

#!/bin/sh


echo "Use parameter s to stop the hogs and parameter c to continue the hogs. Stopping them stops synchronising of ical and phonebook"

echo "it will ask for your admin password"


if [ -z "$1" ] ; then {

inputvar=1; 

}

else {

inputvar="$1";

}

fi


if [ "$inputvar" == 's' ] ; then

sudo killall -STOP callservicesd

sudo killall -STOP soagent

        sudo killall -STOP CalendarAgent

        sudo killall -STOP accountsd

fi

if [ "$inputvar" == 'c' ] ; then

sudo killall -CONT callservicesd

        sudo killall -CONT soagent

        sudo killall -CONT CalendarAgent

        sudo killall -CONT accountsd

fi


Then to stop the hogs, just go

cpu_hog.sh s

and when you need calendar and addressbook to sync again, 

cpu_hog.sh c


Popular posts from this blog

Chunk validation failed

The most useful defaults-write options

Erasing firmware password