Bugs & Fixes: OS X Recent Items glitch
When you click and hold on an application’s dock icon, its dock menu pops up. It typically includes a list of the application’s recently opened documents (assuming it supports opening documents). I find these lists to be the most convenient way to quickly locate and open such files—preferring it to the Open Recent command in applications’ File menus. Except for one thing: the dock menu lists periodically get messed up. Most especially the lists often don’t update as you open new documents, leaving you with an out-of-date list. In contrast, file lists accessed via the Open Recent command are always correct.
I have been particularly bothered by this dock menu glitch with two of my most frequently used apps: OS X’s TextEdit and Preview. On the surface, the symptom seems quite odd. As I assumed that the two list locations drew from the same data, I figured they should always be in sync. The mystery is why this wasn’t so. I decided to investigate. Focusing on TextEdit as the example applications, here’s what I found.
Locating the Recent Items “database”
Navigate to your home directory’s Library folder. A simple way to do this is to hold down the Option key when selecting the Finder’s Go menu. A Library item will appear. Select it.
Once inside the folder, locate and open the Preferences folder. From here, use the Find (Command-F) command to search for all items that contain the word “textedit.”
Several files are likely to appear. The one that we are most interested in is com.apple.TextEdit.LSSharedFileList.plist. This file contains a list of TextEdit’s recently opened files. Depending upon what software you have installed, opening this file to see this list may prove to be a challenge. If you have Apple’s OS X developer software installed, you can open the preferences file in Xcode. Otherwise, you’ll need a third party app such as PlistEdit Pro or PrefEdit.
If you compare the plist file’s list to the Open Recent command’s list, you’ll find the two lists are identical (at least they always have been for me). Similarly, if you select the Clear Items subcommand from Recent Items, you should see that existing documents are removed from both locations. This is all as it should be.
A related file that is likely to be in your Preferences folder is com.apple.TextEdit.SandboxedPersistentURLs.LSSharedFileList.plist. I’m not 100% certain, but this file appears to contain a list of the files that are currently open in TextEdit. TextEdit presumably uses this to determine which documents to re-open automatically after you quit and relaunch the application (assuming you’ve enabled this feature in the General system preferences pane).
You may also find one or more TextEdit preferences files that end in lockedfile.plist. These are “temporary” cache files used to prevent problems if more than one application is attempting to access a preferences file at the same time. To learn more about these lockedfile items, check out MacFixIt’s excellent article on the topic.
The problem is that none of these files seem to have much bearing on the accuracy and updating of the list in TextEdit’s dock menu. For example, if I delete some or all of these preferences files, the dock menu list remains unchanged.
Quitting the Dock
Abandoning my search for answers in the Library folder, I turned my attention to the Dock itself. Specifically, I quit TextEdit and removed its icon from the Dock (by selecting Options > Remove from Dock from TextEdit’s dock menu). When I next launched TextEdit, the news was good: TextEdit’s dock menu list now matched the one in Recent Items. All locations were now correctly in sync. I then went back to TextEdit’s Options and selected Keep in Dock.
Alternatively, I found that I could update the Recent Items lists for all application dock menus in one step. To do so, launch Terminal. From here, type: killall Dock. This forces the Dock to quit and relaunch. At this point, all dock application lists are updated and should be in sync with the File menu’s Recent Items lists.
One problem remained: This fix is not necessarily a permanent one. The first time I tried the fix, TextEdit’s dock menu list soon returned to its out-of-date/out-of-sync status after I began re-opening files in TextEdit. After repeating the fix several times, it finally seemed to take hold. For the moment, my lists are all in sync and remain so. Given past history, I am not confident this will remain the case for long.
In the end, I still haven’t figured out exactly where the incorrect dock data are being cached nor how to guarantee that the symptom does not return. The best I can do for now is re-apply the fix each time the symptom pops up again. Based on confirming reports I have read on the web, this appears to be a known OS X 10.8 bug that Apple has yet to stamp out.