Reconfigure iCloud in MacOS
Many days headache was fixed this morning...
The problem with iCloud on my newly installed MacOS, which is High Sierra, 10.13.6, out of support by Apple.
The machine was installed via Internet, and the MacOS was Mountain Lion, then upgraded to High Sierra, the lastest can be installed in this 2011 iMac.
When connecting to iCloud at beginning, the iCloud can not sync Keychains, it is quite an issue for me, because I need to register all credentials to this iMac separately.
Then I decided to reconfigure iCloud by re-login to iCloud again.
But iCloud could not be registered any more after logout, I thought it could be issue with my unsupported OS.
The symptom was repeating asking for iCloud user and password, no matter which iCloud I like to use. In the email account list, the account is just appear in very short period, then closed immediately.
This morning I tried to send email, found out that I could not add iCloud account, I decided to search solution in Internet.
The solution works for delete all files related to iCloud and system configuration. It is works for my newly configured iMac, because I have nothing in it.
Run following commands in terminal
rm ~/Library/Application Support/iCloud