ICloud – What could cause iCloud Drive to refuse to sync Desktop & Documents

bugdesktopfindericloud

After a sort of manual system restore in which I copied my ~/Library/ from my now-dead 2017 MacBook Pro's BackBlaze to a 2019 MacBook Pro, pretty much all my software has nicely restored its settings, with one exception:

iCloud Drive is behaving quite strangely, and is refusing to sync my Desktop & Documents properly. Everything in my iCloud Drive syncs properly, but the iCloud Desktop and Documents folders are not replacing or integrating with my local ~/Desktop or ~/Documents folders.

Symptoms

One

Desktop & Documents Folders checkbox refuses to stay checked

If I check the box next to Desktop & Documents Folders under System Preferences > iCloud > iCloud Drive > Documents Tab, it spins "Setting up" for about half a second then remains checked, but as soon as I close and reopen the iCloud Drive panel, it is again unchecked. Other checkboxes and options in that panel persist as expected.

Two

Finder Preferences > Sidebar

Finder Preferences > Sidebar shows a very odd glitch where what should be the Documents checkbox has no text label, and a glitchy icon behind the checkbox. When I open the Finder Preferences panel its default state is -. Clicking it toggles it to checked or unchecked. As soon as I close Finder Preferences and reopen it is back to -.

Three

iCloud Drive

All the files which should be in my Desktop and Documents folders show up properly in iCloud Drive/Desktop and iCloud Drive/Documents, both of which appear as normal folders (no icon embedded on the blue folder artwork) in iCloud Drive.

Four

Oddly, when I add, delete, or even just click on any file on my Mac's actual (local, non-syncing) desktop, I see a flurry of activity in brctl (controller for bird, which is the iCloud syncing daemon process.

Below is an example when I simply click to highlight an image file (1919-EclipseGraph.jpg) on my Mac's desktop:

[debug 2019-06-17 14:47:45.897] fileproviderd 
    testing if /Users/jacob/Desktop/1919-EclipseGraph.jpg is in our 1 registered file providers
[debug 2019-06-17 14:47:45.898] fileproviderd 
    -[FPDExtension valuesForAttributes:forItemAtURL:forPID:completionHandler:] asked for (
        NSURLIsUbiquitousItemKey,
        NSURLUbiquitousItemIsDownloadingKey,
        "_NSURLUbiquitousItemDownloadRequestedKey",
        NSURLUbiquitousItemDownloadingStatusKey,
        NSURLUbiquitousItemDownloadingErrorKey,
        NSURLUbiquitousItemUploadingErrorKey,
        NSURLUbiquitousItemIsUploadedKey,
        NSURLUbiquitousItemIsUploadingKey,
        NSURLUbiquitousSharedItemRoleKey
    ) at /Users/jacob/Desktop/1919-EclipseGraph.jpg
[debug 2019-06-17 14:47:45.902] fileproviderd 
    <FPDXPCRemoteObjectProxy: 0x7fcae8e13720>: request starting
[debug 2019-06-17 14:47:45.902] com.apple.CloudDocs.MobileDocumentsFileProvider 
    starting extension: com.apple.CloudDocs.MobileDocumentsFileProvider
[debug 2019-06-17 14:47:45.902] fileproviderd 
    no bundle ID for 262
[debug 2019-06-17 14:47:45.902] fileproviderd 
    sending privilegedValuesForAttributes:forItemAtURL:completionHandler: to com.apple.CloudDocs.MobileDocumentsFileProvider on the behalf of Finder[262]
[debug 2019-06-17 14:47:45.903] fileproviderd 
    can't get values for item at /Users/jacob/Desktop/1919-EclipseGraph.jpg from extension "com.apple.CloudDocs.MobileDocumentsFileProvider"; Error Domain=com.apple.FileProvider Code=-1005 "The file doesn’t exist."
[debug 2019-06-17 14:47:45.903] fileproviderd 
    <FPDXPCRemoteObjectProxy: 0x7fcae8e13720>: request finished
[debug 2019-06-17 14:47:45.903] Finder 
    returning URL properties for /Users/jacob/Desktop/1919-EclipseGraph.jpg
     value: (null)
[debug 2019-06-17 14:47:45.903] fileproviderd 
    Invalidating <FPDExtensionSession(com.apple.CloudDocs.MobileDocumentsFileProvider): 0x7fcae8c03cb0 requests{}, extenders{}> because we don't have any inflight request or lifetime extender #lifetime

Five

The following is a flurry of activity in the system log the moment I check that Desktop & Documents Folders box in iCloud Drive preferences.

The log messages are similar and consistent every time, especially the bird, accountsd, and com.apple.preferences.icloudpreferences processes' messages.

Note that I am filtering only Errors & Faults.

Also note I have replaced all instances of my Apple ID email address as it appeared in the logs with [MY@APPLE.ID]. Nothing else has been replaced or altered.

error   22:52:01.206689 -0400   com.apple.preferences.icloud.remoteservice  [AOSAccounts] : BR can ingest folder: YES - (null)
error   22:52:01.404205 -0400   com.apple.preferences.icloud.remoteservice  [AOSAccounts] : IAAppProvider::SetPropertyToACAccount about to set the following properties to account [MY@APPLE.ID] serviceID com.apple.Dataclass.Ubiquity  and key {
    apsEnv = production;
    authMechanism = token;
    iCloudHomeDesktopEnabled = 1;
    iCloudHomeDocumentsEnabled = 1;
    iCloudHomeEnabled = 1;
    url = "https://p33-ubiquity.icloud.com:443";
    wsUrl = "https://p33-ubiquityws.icloud.com:443";
} and dataclass actions (null)
error   22:52:01.606613 -0400   accountsd   [ERROR] iCloud Desktop Settings change failed: Error Domain=NSPOSIXErrorDomain Code=62 UserInfo={NSDescription=<private>}, resetting to old value
error   22:52:01.606217 -0400   bird    [ERROR] Failed to apply sync policy: -1 for folder type: 2, error: Error Domain=NSPOSIXErrorDomain Code=62 UserInfo={NSDescription=<private>}
fault   22:52:01.635125 -0400   bird    [CRIT] UNREACHABLE: error while fetching recursive properties for item <private>: (null)
error   22:52:01.750867 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:01.751921 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:01.753242 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:01.754566 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:01.756502 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:01.758105 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:01.789576 -0400   com.apple.preferences.icloud.remoteservice  [AOSAccounts] : IAAppProvider::SetPropertyToACAccount about to set the following properties to account [MY@APPLE.ID] serviceID com.apple.Dataclass.Ubiquity  and key {
    apsEnv = production;
    authMechanism = token;
    iCloudHomeDesktopEnabled = 1;
    iCloudHomeDocumentsEnabled = 1;
    iCloudHomeEnabled = 0;
    url = "https://p33-ubiquity.icloud.com:443";
    wsUrl = "https://p33-ubiquityws.icloud.com:443";
} and dataclass actions (null)
error   22:52:01.794579 -0400   com.apple.preferences.icloud.remoteservice  [AOSAccounts] : IAAppProvider::SetPropertyToACAccount about to set the following properties to account [MY@APPLE.ID] serviceID com.apple.Dataclass.Ubiquity  and key {
    apsEnv = production;
    authMechanism = token;
    iCloudHomeDesktopEnabled = 1;
    iCloudHomeDocumentsEnabled = 1;
    iCloudHomeEnabled = 0;
    url = "https://p33-ubiquity.icloud.com:443";
    wsUrl = "https://p33-ubiquityws.icloud.com:443";
} and dataclass actions (null)
error   22:52:01.922416 -0400   SafariBookmarksSyncAgent    SimulatedCrash: <private>
error   22:52:02.214011 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:02.217857 -0400   accountsd   "Method \"<private>\" called on ACAccount without a valid ACAccountStore!"
error   22:52:02.504334 -0400   SafariBookmarksSyncAgent    SimulatedCrash: <private>
error   22:52:02.730035 -0400   SafariBookmarksSyncAgent    SimulatedCrash: <private>
error   22:52:02.859159 -0400   kernel  Sandbox: SafariBookmarksS(366) deny(1) file-write-data /Users/jacob/Library/Preferences/com.apple.SafariBookmarksSyncAgent.plist
error   22:52:02.859225 -0400   cfprefsd    rejecting write of key MigrationStateEncodedRecordData in { com.apple.SafariBookmarksSyncAgent, jacob, kCFPreferencesAnyHost, no container, managed: 0 } from process 366 because setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
error   22:52:02.859340 -0400   SafariBookmarksSyncAgent    Couldn't write value for key MigrationStateEncodedRecordData in CFPrefsPlistSource<0x7fb81ad03060> (Domain: com.apple.SafariBookmarksSyncAgent, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
error   22:52:02.859698 -0400   SafariBookmarksSyncAgent    SimulatedCrash: <private>
error   22:52:02.948863 -0400   accountsd   "Cannot check access to a private account type: <private>"
error   22:52:02.967568 -0400   accountsd   "Cannot check access to a private account type: com.apple.account.AppleAccount"
error   22:52:03.394179 -0400   cfprefsd    rejecting write of key MigrationStateEncodedRecordData in { com.apple.SafariBookmarksSyncAgent, jacob, kCFPreferencesAnyHost, no container, managed: 0 } from process 366 because setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
error   22:52:03.394364 -0400   SafariBookmarksSyncAgent    Couldn't write value for key MigrationStateEncodedRecordData in CFPrefsPlistSource<0x7fb81ad03060> (Domain: com.apple.SafariBookmarksSyncAgent, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access
error   22:52:03.429250 -0400   SafariBookmarksSyncAgent    SimulatedCrash: <private>
error   22:52:04.930589 -0400   nsurlsessiond   nw_protocol_boringssl_get_output_frames(1301) <private>[0x7fac8ab5c540] get output frames failed, state 8196
error   22:52:04.930678 -0400   nsurlsessiond   nw_protocol_boringssl_get_output_frames(1301) <private>[0x7fac8ab5c540] get output frames failed, state 8196
error   22:52:04.931149 -0400   nsurlsessiond   TIC Read Status [527:0x0]: 1:57
error   22:52:04.931177 -0400   nsurlsessiond   TIC Read Status [527:0x0]: 1:57

Already Tried

I've already attempted the following, each with no effect on the situation:

  • Reboot
  • Log out of and back into iCloud
  • Reinstall macOS via internet recovery
  • killall bird
  • killall bird followed by reboot
  • Delete ~/Library/Application Support/CloudDocs/ and wait for it to rebuild
  • Delete ~/Library/Preferences/com.apple.finder.plist and ~/Library/Preferences/com.apple.sidebarlists.plist.

What could cause this behavior? What is the fix?

My machine synced fine with iCloud (including Desktop and Documents in their expected locations) before restoring my old machine's ~/Library, so I'm fairly certain there is some file or preferences in there that are causing this. Any others I should try deleting to give iCloud Drive a "factory reset", without losing all my other restored application settings?

Best Answer

Looks like the culprit was a circular link at ~/Documents. If this is the case for you, oddly Documents won’t appear at all in your home directory in Finder. However you’ll notice some weird things:

  1. That odd empty slot in your Finder Preferences > Sidebar tab (see above)

  2. If you try to create a folder called Documents in your home directory, you get a Finder error dialog saying it already exists.

  3. If you try to open Documents using Finder > Go > Documents (⇧+⌘+O), you get a Finder error dialog saying it doesn't exist.

Here's the giveaway: run ls -l in your home directory, and look for Documents. Here's what I saw:

lrwxr-xr-x@   1 jacob  staff    22 Jun 11 15:39 Documents -> /Users/jacob/Documents

A quick rm Documents and that was taken care of.

Wait 2 minutes, (apparently some background process has to notice the deletion) then suddenly the Desktop and Documents Folders checkbox under the iCloud PrefPane begins sticking again.

About two hours later (it can take a while) and I saw all my iCloud Drive files being populating my Desktop and Documents in droves.


The above, of course, is a bit of a simplification. Because this has been so perplexing I'll say exactly what I did—who knows which of these steps mattered.

  1. I actually ran rm -rf ~/Documents (note the -rf flags)
  2.  > About This Mac > Storage > Manage…
  3. Under Recommendations tab, click Store in iCloud…
  4. Check Desktop and Documents
  5. Store in iCloud (I believe I recall this also not "sticking" when I pulled up that panel again, but I did it nonetheless)

  1. Wait 2 minutes. Actually make it 3.

  1. System Preferences > iCloud > iCloud Drive > Options… > Documents (tab) > check Desktop & Documents Folders
  2. This time, it stuck. A few moments later Documents and Desktop showed up under the iCloud section in my Finder sidebar.
  3. Wait a long time for it all to sync. Possibly overnight. Files tend to show up in batches, per folder. If you have Optimize Storage on it appears that files under 1MB are downloaded in full while files over 1MB only have metadata downloaded.