iCloud Drive stuck uploading and downloading files in Mac OS X Mojave

Recently, my MacBook Pro, running Mac OS X Mojave, got into a state in which the Finder wasn’t uploading or download files to and from iCloud Drive. Since I couldn’t find any solution to this through Googling, I wanted to document how I solved the problem for others who may be experiencing the same.

I think, but can’t be sure, that the problem was related to allowing GitHub Desktop to store my repositories in the “Documents” folder, which is synchronized with iCloud Drive.

One of my repositories had literally tens of thousands of files, and even though I had deleted it long ago on my Mac, I discovered through troubleshooting that it was still present in iCloud Drive, when accessed via the web.

To solve the problem, after moving my GitHub folder outside of Documents, I then backed up all the files in Desktop and Documents on my Mac that I need, and disabled “iCloud Drive” in the iCloud area of the system preferences, and instructed the Mac to delete all the local files.

I then went into iCloud Drive via the website, and started deleting everything from there.

Step one was selecting my repo folder in Documents, and deleting it.

Step two was going into “Recently Deleted”, and then purging the folder from there.

But this turned out to be very confusing, because although the purging of the repo folder appears immediate in the browser UI, it’s actually a very long process that’s happening—in the browser! While that’s going on (with no UI feedback) other files and folders in “Recently Deleted” area appear grayed out. You can select them, but you can’t delete them.

After a while of frustration, an error message popped up saying certain files in my repo folder couldn’t be deleted, at which point the folder re-appeared in the “Recently Deleted” area. Ultimately, I had to go into the folder, and delete its contents in small batches. Once that whole folder was deleted, the grayed out files and folder then lit up, and could be deleted themselves.

So the fact that deletions are getting processed one by one in the browser, but there’s no UI to indicate that, can cause terrible confusion when trying to perform the kind of mass cleanup that I was doing.

In the end, when everything was finally deleted and purged, I re-enabled iCloud Drive on the Mac, and everything returned to normal.