Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am looking for a way to reload/refresh the "apple symbol" menu in the upper left corner from the terminal.

Searching for ways to refresh the menu has only led me to find the command

killall -KILL SystemUIServer

this only reload the "widgets" on the right side of the menu and not the content on the left.

I am looking for a way to do this since I have emptied the "recent files" menu programatically (by removing the info from the com.apple.recentitems.plist file with defaults delete com.apple.recentitems RecentDocuments) but it doesn't show up. (I know that it is possible to turn off the recent files menu completly but that is not what I want).

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

So I finally found a solution to this.

I compiled the following Objective-c code and call it through the terminal.

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

  @autoreleasepool {
    LSSharedFileListRef recentDocsList = LSSharedFileListCreate(NULL, kLSSharedFileListRecentDocumentItems, NULL);
    LSSharedFileListRemoveAllItems(recentDocsList);
    NSLog(@"Cleared files!");
  }
   return 0;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.