Monday, June 29, 2009

Tidying up Finder's "Open With" menu

Many applications can open common file types such as HTML or JPG, and they all, conveniently, get an entry in Finder's "Open With" contextual menu. Under many circumstances this is even true for applications that are installed in VMware Fusion or Parallel Desktop. Unfortunately, when you delete these applications, or you decide that you don't want applications in virtual machines to open files, the context menu items remain. In my case some context menus became cluttered to the point of being unusable.

This is such an obvious problem that I expected to find an answer using Google straight away. Maybe my search skills failed me but it took me a good while to find the right answer for Leopard, which is why I want to share it here.

There is this article on Lifehacker. However, the article itself has it wrong; the real solution is in a response by "mtts" halfway down the page, and even then the command doesn't work as described on Leopard. What did the trick for me, on Leopard, was the following command:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

There is no manpage for lsregister but invoking it without any arguments will display some help.