six colors

by Jason Snell & Dan Moren

This week's sponsor

Photos: A Take Control Crash Course - Jason's ebook about Photos, now updated for High Sierra & iOS 11.

By Dan Moren

Clean out a messy Open With menu in the Finder

Contextual menu
Before and after clean-up

We’re used to cruft accumulating in all sorts of unwanted places in our lives, but among my least favorite is the Finder’s Open With contextual menu. You’ve probably run into this: you go to open a file with an app that isn’t the default, and you’re presented with a list of options as long as your arm—many of them duplicates (see above, left).

What gives? Well, when you install an app on your system, it registers that it’s willing to handle certain filetypes—“Oh, JPEGS? Yeah, no problem!” That information is stored in the Launch Services database, so when you right-click on a JPEG and choose Open With, the Finder rounds up a list of viable candidate applications.

Unfortunately, over time, this database accumulates that aforementioned cruft: old versions of applications don’t get cleaned, or even programs you’ve long removed. Fortunately, this handy tip—courtesy our old friends at Mac OS X Hints—can help you whip that database into a lean, mean, contextual machine.

Fire up a Terminal window and paste in the following command:

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

That uses lsregister—the Launch Services command-line tool—to rebuild OS X’s internal database, throw out outdated entries, and make sure that everything’s all up to date. When you’re done you’ll need to relaunch Finder, which you can either do from the command line—enter killall Finder—or by option-control clicking on the Finder icon in the Dock and choosing Relaunch.

Next time you use that Open With dialog box, it’ll be much, much cleaner (see above, right). Now, if only there were a similar command for those couch cushions.

Update: Whoops, the previous version of the command was for pre-10.8. This version should work with newer versions of OS X.

[If you appreciate articles like this one, help us continue doing Six Colors (and get some fun benefits) by becoming a Six Colors subscriber.]

[Dan Moren is a tech writer, novelist, podcaster, and the Official Dan of Six Colors. You can email him at dan@sixcolors.com or find him on Twitter at @dmoren.]