Terminal Tips: Rebuild your Launch Services database to clean up the Open With menu
Problem: Some piece (or pieces) of rogue software have cluttered up your Open With contextual menu, which you can see by right-clicking or control-clicking any document in the Finder. This problem seems to be most prevalent with virtual machines that allow you to open documents with Windows applications, but tend not to clean up after themselves. After having both Parallels and VMWare installed on my MacBook Pro, my Open With menu was a mess.
Solution: Lucky for me, I noticed David Chartier's question about this on Twitter around the same time as I was wondering what to do about it. Some friendly person pointed him to a posting on Apple's discussion forum (also noted on Mac OS X Hints here and here), noting that running a specific command in a terminal window will rebuild your launch services, which repopulates the Open With menu with a current list of applications, without duplicates. It worked perfectly for me, but beware, on my system it took about 10 minutes to complete, and I suspect it could take more on a sufficiently gummed-up system.
Here's the Leopard version of the command (the path to the tool is different in Tiger, see here). I broke it into three lines for readability, but the \ at the end of the line is bash-speak for "keep on going with the same command" -- you can copy and paste it directly and it should work, or if you type it on one line without the backslashes, it will also work fine.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/lsregister -kill\
-r -domain local -domain system -domain user
If, preferring to avoid the Terminal, you want a handy GUI app to rebuild the Launch Services database with a couple of clicks, check out Titanium's OnyX or Maintenance utilities, both free of charge.
Share
Categories
Problem: Some piece (or pieces) of rogue software have cluttered up your Open With contextual menu, which you can see by right-clicking or...
Add a Comment
Inquiring minds want to know..
Why does the LaunchServices Database need to be rebuilt? What causes it?
eg I have imacs dual booting to 10.5 and XP. I'd like to blame XP for corrupting the LS but I can't figure out how it would.
Help?
THANK YOU!! I've been wondering how to fix this problem for years now, heh.
June 12 2009 at 11:44 AM Report abuse Permalink rate up rate down ReplyWhen I ran that, I got this error: SystemFlippers: didn't consume all data for vers ID 1 (pBase = 0x2cd54, p = 0x2cd66, pEnd = 0x2cd67)
Ideas? I can say that it seems to have worked, anyway.
Onyx is another wonderful, free app that can rebuild Launch Services.
June 11 2009 at 9:26 PM Report abuse Permalink rate up rate down ReplyUnfortunately, it didn't help with my "DashCode is the ruler of .css files and no matter what you do, you will never be able to override it!" problem. I've tried file information:Open With:Change All (with and without Always Open With checked), and right click:Open With:Other (with and without Always Open With checked). Neither worked. If anyone knows of anything other than uninstalling DashCode, please let me know. I want to punch my computer in the face every time DashCode opens my CSS files instead of Smultron. Of course, I may just have to uninstall DashCode and hate Apple for not obeying their own rules.
June 11 2009 at 8:45 PM Report abuse Permalink rate up rate down Replyfor some reason it would not work for me when not in one line - probably an issue with the copying - thanks a lot, I was just annoyed today by double entries and old junk
June 11 2009 at 6:04 PM Report abuse Permalink rate up rate down ReplyGreat post. Another easy to use tool to rebuild your Launch Services database, for those shy of delving into Terminal commands, is Cocktail. Similar to Onyx. You can get it from here: http://www.maintain.se/cocktail/index.php
June 11 2009 at 6:00 PM Report abuse Permalink rate up rate down ReplyFantastic post, thanks!
Just a note on both my machines (mac pro with a 3 disk striped RAID and a C2D mac mini) this took ~30 seconds to run. Your machine must have an insane amount of applications for it to take 10 minutes!
Someone did something silly with their text...
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/ LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
is waaaaaay past the boundaries.
Lost some breaks in the edit. Fixed!
June 11 2009 at 5:30 PM Report abuse Permalink rate up rate down ReplyHot Apps on TUAW
Deals of the Day
more deals- Verizon Leather Sleeve for Tablets for $4 + free shipping
- Wicked Jaw Breaker Noise-Isolating In-Ear Headphones for $6 + free shipping
- Refurb Apple MacBook Air Laptops: 12" 64GB SSD for $699 + free shipping
- JVC Motion Sensing Clock Radio with Dual iPod Docks for $55 + free shipping
- Apple iPhone Headset with Mic for $4 + $2 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



11 Comments