iCloud sign out not possible on High Sierra

I recently changed my Apple ID mail address. I was getting messages that I have to enter my password for my old iCloud address. Therefore I attempted to sign out on the system preferences. However every time I try this it gets stuck at some loading process. I have every iCloud service disabled. The internet-accounts panel says that this is not my primary iCloud account. I tried deleting the keychains folder and signed out and on again.


Solution 1:

I was able to fix the issues by deleting the files in ~/Library/Accounts/ and ~/Library/Preferences/MobileMeAccounts.plist then logging out and in again before opening the panels again. Warning: This also removes every other account you have listed in the accounts folder.

Solution 2:

you need to sign out from the primary account. If you can login to icloud.com and check for device registered, if it is registered under same apple ID. Then go to settings>check for that device> click on "x" mark for removing device. Then reboot the device once and apple ID should able to signout from macos. Second option, go to system preference under users and groups. Select the local administrator and right click for selecting advanced options, check for Apple ID configured, in case of different apple. Try to change to your current apple ID and sign out from system preference.

Solution 3:

The issue I ran into was that after a manual restore ownership of files in /var/db was incorrect. All the directories was incorrectly owned by root.

For 10.13.6 the correct owners seems to be:

drwxr-x---    6 _analyticsd         _analyticsd             192 Aug 16 19:18 /var/db/analyticsd
drwx------    3 _applepay           _applepay                96 Aug 13 17:06 /var/db/applepay
drwxr-xr-x    2 _astris             _astris                  64 Apr  9 21:28 /var/db/astris
drwxr-x---    2 _cmiodalassistants  _cmiodalassistants       64 Apr  9 21:28 /var/db/cmiodalassistants
drwx-----x    4 _datadetectors      _datadetectors          128 Aug 18 10:26 /var/db/datadetectors
drwxr-xr-x    4 _displaypolicyd     _displaypolicyd         128 Aug 18 18:57 /var/db/displaypolicyd
drwxr-xr-x    3 root                wheel                    96 Aug 13 18:02 /var/db/efw_cache
drwxr-xr-x    2 _findmydevice       _findmydevice            64 Apr  9 21:28 /var/db/findmydevice
drwxr-x---    4 _fpsd               _fpsd                   128 Aug 16 04:13 /var/db/fpsd
drwxr-x---    2 _geod               _geod                    64 Apr  9 21:28 /var/db/geod
drwxr-x---    3 _hidd               _hidd                    96 Aug  3 02:53 /var/db/hidd
drwxr-x---    4 _locationd          _locationd              128 Aug 18 18:56 /var/db/locationd
drwx------    3 _usbmuxd            _usbmuxd                 96 Aug 13 17:06 /var/db/lockdown
drwxr-x---    3 _nsurlsessiond      _nsurlsessiond           96 Aug  3 02:52 /var/db/nsurlsessiond
drwxr-xr-x    3 _nsurlstoraged      _nsurlstoraged           96 Aug 13 18:07 /var/db/nsurlstoraged
drwxr-xr-x    2 _ondemand           _ondemand                64 Apr  9 21:28 /var/db/ondemand
drwxr-x---    3 _securityagent      _securityagent           96 Aug 13 17:06 /var/db/securityagent
drwxr-xr-x    3 _softwareupdate     _softwareupdate          96 Aug 18 18:57 /var/db/softwareupdate
drwxr-x---    4 _timed              _timed                  128 Aug 18 18:57 /var/db/timed