Every now and then, solutions to problems just fall from the sky, or, in this case, from TidBITS Talk. In a recent post, Shirley Jordan noted that whenever she right-clicked on a document in the Finder and displayed the Open With submenu to open the document in something other than its default application, every application in the menu appeared twice. Quick responses from Miraz Jordan, Alan Forkosh, and Curtis Wilcox revealed that the problem was a corrupt Launch Services database and a single Terminal command can resolve it, as can options in utilities like Cocktail.
I was in the same situation — I’d been seeing two or even three copies of each application in the Open With submenu, but it was never annoying enough to hunt down the solution. So I was happy to have it fall in my lap via email, and after pasting the command below (as one line) into Terminal and relaunching the Finder by Control-Option-clicking its Dock icon and choosing Relaunch, my Open With submenu shrunk to only a single copy of each application.
Conrad Hirano subsequently noted that relaunching the Finder wasn’t sufficient for his Mac to reset its Open With submenu completely, and he needed to log out and back in to finish the job. Personally, whenever anything is being weird, I prefer restarting the Mac entirely, which doesn’t take significantly longer.
sudo /System/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
As far as I can tell, there’s no downside to rebuilding the Launch Services database in this fashion, though it’s also not something you should do without good reason, such as the duplicate entries in the Open With submenu.