High CPU and energy usage in Safari

Solution 1:

I know this is probably a little late but I hope it helps someone else.

I found the reason Safari was using so much CPU was due to faulty permissions. It was stuck in a loop trying to access a file it couldn't.

To see if this might be an issue for you run:

sudo /usr/libexec/repair_packages --verify --standard-pkgs /

And see if there are any files wile damaged permissions. For me it was:

Permissions differ on "Library/Java", should be drwxr-xr-x , they are drwxrwxr-x .
User differs on "private/var/db/displaypolicyd", should be 0, user is 244.
Group differs on "private/var/db/displaypolicyd", should be 0, group is 244.

So it is a good chance Java permissions are the culprit. To fix run:

sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /

And then restart Safari. For me this immediately dropped CPU use from 150% to 14%.

One should note if you have 100s of faulty permissions, it could be an early sign of disk failure. As always, keep backups.

I hope this helps someone else out there.