By Dan Moren
October 21, 2015 12:46 PM PT
Clean out a messy Open With menu in the Finder
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
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.
[Dan Moren is the official Dan of Six Colors. You can find him on Twitter at @dmoren or reach him by email at email@example.com. His latest novel, The Aleph Extraction, is out now and available in fine book stores everywhere, so be sure to pick up a copy.]
If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.