Skip to Content

Terminal Tips: Rebuild your Launch Services database to clean up the Open With menu

TipsProblem: 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.

Categories

Terminal Tips Leopard

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

*0 / 3000 Character Maximum

11 Comments

Filter by:
roger

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?

September 03 2009 at 5:29 PM Report abuse rate up rate down Reply
Brett

Great tip, thanks.

June 13 2009 at 1:41 PM Report abuse rate up rate down Reply
Aaron

THANK YOU!! I've been wondering how to fix this problem for years now, heh.

June 12 2009 at 11:44 AM Report abuse rate up rate down Reply
lmo

When 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.

June 12 2009 at 10:14 AM Report abuse rate up rate down Reply
maccamb

Onyx is another wonderful, free app that can rebuild Launch Services.

June 11 2009 at 9:26 PM Report abuse rate up rate down Reply
robert

Unfortunately, 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 rate up rate down Reply
tukan

for 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 rate up rate down Reply
damian.claassens

Great 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 rate up rate down Reply
Greg

Fantastic 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!

June 11 2009 at 5:33 PM Report abuse rate up rate down Reply
Willson Smith

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.

June 11 2009 at 5:24 PM Report abuse rate up rate down Reply
1 reply to Willson Smith's comment
Michael Rose

Lost some breaks in the edit. Fixed!

June 11 2009 at 5:30 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.