For some time I’ve been experiencing really slow folder opening in Finder and Open/Save panels. Clicking to open a folder would take anywhere from a few seconds to a minute to appear. I lived with this for some time, until I was debugging something and went to watch my syslog.
As it turns out, this is caused by a corrupt CloudKit database. The
cloudd daemon repeatedly crashes trying to read it and then gets re-launched by launchd. Here’s an example of the syslog message:
Apr 06 23:05:14 yivo cloudd <Error>: *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Error executing SQL: "begin exclusive" (266) - errcode:010a, msg:"disk I/O error", path:/Users/USER/Library/Caches/*/CloudKitMetadata'
Trying to read the database with
sqlite3 proved my suspicions further:
/Users/kirb/Library/Caches/CloudKit$ sqlite3 CloudKitMetadata SQLite version 3.8.5 2014-08-15 22:37:57 Enter ".help" for usage hints. sqlite> .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; /**** ERROR: (10) disk I/O error *****/ ROLLBACK; -- due to errors sqlite>
The fix — just delete the database. OS X will download and recreate the data for you.
In Finder, press Shift-Command-G. Type in: ~/Library/Caches/CloudKit. When it eventually loads, move
CloudKitMetadata-wal to the Trash. Alternatively, open Terminal (it’s in /Applications/Utilities), and enter:
cloudd a moment to crash and relaunch, and all will be good.