After updating to macOS 10.15.7 (but the problem is also reported with other versions of macOS) some users report problems with the accountsd process, visible by starting the Activity Monitor utility. In some cases the process in question takes up an excessively high percentage of the CPU (up to 400%) helping to slow down the computer, causing the fans to start and abnormally consuming the battery.
When the problem occurs, the Finder appears to be unresponsive or slow to respond. You can open the Activity Monitor utility and check the CPU occupation percentage; for the process in question, a value higher than 400% could be indicated, a sure indication of some anomaly.
It is possible to make several attempts but the final solution seems to use the Terminal to execute some commands (shown below) to terminate the com.appleiCloudHelper process, move the iCloud .sqlite database to a backup folder, delete the accountsd process and restart.
sudo -v killall -9 accountsd com.apple.iCloudHelper defaults delete MobileMeAccounts mkdir ~/Library/Accounts/Backup mv ~/Library/Accounts/*.sqlite* ~/Library/Accounts/Backup/ killall -9 accountsd com.apple.iCloudHelper sudo reboot
Apple explains in the developer documentation that the accountsd process allows you to access and manage external accounts from within apps without requiring them to provide login credentials. The Accounts framework provides access to user accounts stored in the Accounts database, which is managed by the system.
An account stores the login credentials of a particular service, such as Twitter, and those credentials are used to authenticate with the service. By integrating the Accounts framework into your app, you dont need to store login accounts on your own; on the contrary, the user grants your app access to the login credentials for the account, bypassing the need to provide username and password.
Note:In some cases executing the above commands may result in a loss/disappearance of accounts/mail form Mac mail client. Execute the commands at your own risk.