macososx-lionosx-mavericksosx-yosemiteosx-mountain-lion

Clear Recent items in Preview Application of Mac OS X..?


Hello all,

Can anyone tell me how to clear the 'Recent items' list in Preview application of Mac OS X through code? Is there a terminal command that can do this?

Or is there any way to click on 'Clear Menu' in 'Open Recent' of the 'File' menu in Preview?

Alternatively, does someone know where Preview stores this information and how do to remove it?

Check out this image to see what I mean.


Solution

  • You may try the approach outlined here, which is to run

    defaults delete com.apple.Preview.LSSharedFileList RecentDocuments
    

    in the Terminal (manually or through your app). However I tried this and it didn't work for me (OSX 10.11), since the Preview defaults file doesn't contain this entry.

    You can use

    defaults write com.apple.Preview NSRecentDocumentsLimit 0
    

    which will hide all recently used items, but as soon as you set that number to anything greater than 0, they will show up again.

    I also checked the ScriptingBridge Interface for Preview, but couldn't find anything useful. So unfortunately it looks like this is not possible.