Recently, I noticed that MacOS (Catalina) is running slow. Apps regularly show the spinning rainbow wheel cursor, and video conference apps don't work. I had a load average of over 20, and after quitting all apps, I could only get it down to 16. Normally I see a load average of 1 to 3, even with all my apps open.
I resorted to rebooting my laptop, costing me hundreds of open windows in several apps. When the login screen appeared, I SSH'd into it from another machine. Without any graphical logins, the load average was already 13. I couldn't identify any apps that were consuming a lot of resources. There was some daemon that collects data for Spotlight to use, but it was only using 10% CPU according to top
.
After logging in locally, the load average is back to 15 with just a couple of terminals running, and I'm already getting the rainbow cursor.
There's absolutely nothing suspicious in /var/log/system.log, nor in the output of dmesg.
MacOS has never worked very well, but it's never been this bad. How can I find out what it's doing and why?
EDIT: Here's the output of top
with no local users:
Processes: 150 total, 2 running, 148 sleeping, 718 threads 11:46:13
Load Avg: 11.63, 4.14, 1.62 CPU usage: 0.45% user, 62.52% sys, 37.1% idle
SharedLibs: 219M resident, 26M data, 24M linkedit.
MemRegions: 13721 total, 596M resident, 61M private, 349M shared.
PhysMem: 2847M used (1660M wired), 13G unused.
VM: 711G vsize, 1991M framework vsize, 0(0) swapins, 0(0) swapouts.
Networks: packets: 607/181K in, 917/272K out. Disks: 54410/873M read, 1852/14M written.
PID COMMAND %CPU TIME #TH #WQ #POR MEM PURG CMPR PGRP PPID STATE BOOSTS
287 mdsync 10.9 00:01.59 3 1 43 4524K+ 0B 0B 287 1 sleeping *0[1]
0 kernel_task 4.8 00:52.13 266/12 0 0 37M 0B 0B 0 0 running 0[0]
343 top 3.0 00:00.63 1/1 0 25 1868K 0B 0B 343 293 running *0[1]
203 airportd 1.1 00:01.68 16 14 175+ 6248K+ 0B 0B 203 1 sleeping 0[10]
188 WindowServer 1.1 00:06.19 9 4 343 109M 1512K 0B 188 1 sleeping *0[1]
216 usbd 0.6 00:00.53 3 2 90+ 2992K 0B 0B 216 1 sleeping 0[0]
59 configd 0.4 00:01.94 11 4 330+ 4144K 0B 0B 59 1 sleeping *0[1]
269 SecurityAgen 0.4 00:04.36 3 1 287 248M 2052K 0B 269 1 sleeping *0[1]
49 UserEventAge 0.2 00:01.71 6 3 410 4184K 0B 0B 49 1 sleeping *0[1]
1 launchd 0.1 00:03.21 3 2 1433 10M 0B 0B 1 0 sleeping 0[0]
58 systemstats 0.1 00:01.04 3 2 97 4132K+ 0B 0B 58 1 sleeping 0[1]
106 AirPlayXPCHe 0.1 00:00.62 6 3 167+ 4132K+ 0B 0B 106 1 sleeping *0[1]
143 contextstore 0.1 00:00.90 4 3 107+ 5232K+ 236K 0B 143 1 sleeping 0[52]
96 PerfPowerSer 0.1 00:02.70 8 5 275 9912K 256K 0B 96 1 sleeping 0[14]
218 VDCAssistant 0.0 00:00.17 2 1 28 2856K 0B 0B 218 1 sleeping *0[1]
61 powerd 0.0 00:00.82 3 2 100 2676K 0B 0B 61 1 sleeping *0[1]
107 notifyd 0.0 00:00.62 2 1 137 972K 0B 0B 107 1 sleeping *0[1]
102 bluetoothd 0.0 00:00.51 3 2 111+ 4132K 0B 0B 102 1 sleeping *0[1]
292 sshd 0.0 00:00.01 1 0 19 1036K 0B 0B 288 288 sleeping *0[1]
251 TouchBarServ 0.0 00:00.47 4 1 254 12M 5888K 0B 251 1 sleeping *0[1]
103 hidd 0.0 00:00.86 6 2 268 3076K 0B 0B 103 1 sleeping *0[1]
/Applications/Utilities
). It's similar totop
, but with a nice GUI. You can use it to find out which apps have high CPU, memory, energy or network usage. You write "costing me hundreds of open windows in several apps" - you can configure macOS to restore windows when opening an app, just uncheck "Close windows when quitting an app" in System Preferences > General (when shutting down or restarting your Mac, select "Reopen windows when logging back in").