Eliminate Duplicates in the Open With Submenu
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.
I had the same problem and solved it, if I recall correctly, by first doing a safe boot of my iMac and then rebooting normally. This is a process which seems to clear a lot of crufty little problems like that since it clears a lot of caches.
Safe boot did the trick for me. Thanks for the tip.
My Open With Submenu is littered with TimeMachine dupes of my apps. Using sudo command didn't fix the problem.
But then I realized I could at least exclude the Applications folder from TM.
Nolan, give the Cocktail app or Michael's safe boot approach a try - perhaps there are multiple caches that need to be reset and the sudo command isn't doing all that's necessary.
Most people using Time Machine would have their Applications folder being backed up, so I can't imagine that it's the standard behavior (and I certainly don't see duplicates from my Time Machine backups - my dupes went away when I reset Launch Services).
I think Time Machine drives are automatically excluded from Spotlight indexing. However, I could see there being something like an "default write" option that would include them. Also, if a drive was formerly used for Time Machine but still contained backups, those backups could be indexed by Spotlight.
Great timing, as this had just started happening to me on my laptop. The sudo command did not seem to work, but the Cocktail app fixed it.
Thanks.
Neither the Terminal command or Cocktail worked for me until I also repaired Disk Permissions. (I used MainMenu to rebuild Launch Services, restart the Finder, and repair Disk Permissions.)
The Terminal command did not worked for me neither. I downloaded MainMenu and used it to rebuild Launch Services. After that, all was OK. Thank you.
And if you want to read this in Czech...
http://www.autoteiledirekt.de/science/odstraneni-duplicit-v-podnabidka-otevrit