Rebuild LaunchServices to Fix Duplicate Entries in OS X's 'Open With' Menu
While most files in OS X are configured to open with a specific application by default, users have the option to use a handy “Open With” menu, found by right-clicking (or Control-clicking) on a file. This lets users keep a default application for viewing most files, but still have quick access to another compatible application when needed. A great example is setting OS X to open image files with Preview by default, but using the Open With menu to open the image with Photoshop for editing tasks.
However, the Open With menu can sometimes get out of control. Users who have upgraded their apps over time might find old versions referenced in the list, and those who migrate their OS X installation to a new drive could see duplicate entries.
Something similar happened when we moved our TekRevue production Mac from an iMac to a Mac Pro. We migrated our data by cloning the iMac’s drive to the Mac Pro’s, which worked fine except we had duplicate entries of all of our applications in the Open With menu.
To fix this, we need to reset OS X’s LaunchServices database. As is the case with most actions in OS X, there are multiple ways to accomplish this task, but the fastest is to simply use a Terminal command.
Our test system is running OS X Mavericks 10.9.1, but these instructions work with OS X Lion and OS X Mountain Lion as well. To get started, close all open applications and then launch Terminal from Macintosh HD > Applications > Utilities. Copy and paste the following command at the Terminal prompt and press Return to execute it:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Terminal will appear to freeze for a few moments as the command is processed. When it’s finished, you’ll see a new prompt appear in the window. You can now close Terminal and head back to your Desktop. Find a file you need to access using the Open With menu and you’ll now see that the list is cleaned up, with duplicate and outdated entries gone.
Note that we didn’t have to reboot our Mac to see the results of the command, but if you don’t see a change on your end, try rebooting before resorting to other methods.
Alternative Methods of Rebuilding LaunchServices
The Terminal method described above is easy and may not even require a reboot, but there are two other ways to rebuild LaunchServices if you are so inclined. The first is to use an application called OnyX, which can perform and automate a number of OS X maintenance tasks. Once you launch OnyX, you’ll find LaunchServices listed in Maintenance > Rebuild. Just check the LaunchServices box and press Execute to rebuild it.
Another option is to manually delete the LaunchServices preference file. Quit all open applications and navigate to ~/Library/Preferences. Locate com.apple.LaunchServices.plist, delete the file, then reboot your Mac. This should accomplish the same result as using OnyX or the Terminal command, above.