56

I recently went to open an audio file, and wanted to open it in an editor instead of a player. I right-clicked it, hovered over 'Open With...' and was met with a very unsightly list.

List of Supported Audio Apps

I have seen a problem in the past where apps will have previous versions stuck in the /Applications folder with their version number appended, but that is not the case here. Despite the duplicity in this list, no app is duplicated in /Applications nor anywhere else I can find on my system.

What causes this list to become filled with duplicates, and how can I remove them and ensure only the latest (and functional) version is list?

Jason Salaz
  • 24,471

6 Answers6

52

Applications don't have to live in /Applications. If you have a clone of your system mounted, that can account for some duplicates, but certainly not what you are observing. The list of programs for Open with… is maintained in the Launch Services database. If the list contains many duplicates as yours does, the database looks like it needs rebuilding.

Macworld Hints offers a suggestion as to how you can fix this:

The lsregister command, found at System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister, can tell the database to reset. Macworld recommends running the command thusly: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Note that utilities like Onyx or Cocktail can also reset this database for you. Do note that Finder won't re-read the new database so you will either have to log out and in again or issue a killall Finder if you don't mind just killing it for any users on your Mac to avoid a log out and in.

sorin
  • 29,875
Daniel
  • 34,803
  • 2
    This will help with the duplication, and has worked for me several times, so +1. Do you have anything to help the OP with the second part of the question: how to EDIT this list? – Redandwhite Sep 16 '12 at 13:45
  • 1
    @Redandwhite Actually, he answered my questions to the extent that I meant them. By edit it, I really did mean just delete the dupes, and lsregister will do that for me. If you'd like to edit it outright, ask it as your own question. The best part of that is, you'll get the upvote rep for yourself that way :). – Jason Salaz Sep 16 '12 at 20:44
  • Well, he answered my questions, but unfortunately that didn't resolve the problem. The list remains identical after running the command given in the answer. The image linked in this comment shows that I'm fairly confident that there is only one copy of the Spotify app bundle on my system despite the amount shown in the list. – Jason Salaz Sep 17 '12 at 10:28
  • 3
    I take it back. The process appears to just have taken some time to run, but I viewed 'Open With...' not 2 minutes ago. The list is clean again. Yay! – Jason Salaz Sep 17 '12 at 13:26
  • Yay! Glad it worked for you. I've been digging and I haven't come up with a better answer, so I'm glad this one worked. – Daniel Sep 17 '12 at 13:59
  • I created an app to clean the open with menu. You can download it here and find more information about this situate and the underlying process here. Hope this helps. – Stephane Paquet Apr 30 '14 at 05:52
  • This seems to have busted my OSX UX experience. Now half the time I pick Open With I get a "fetching..." and it takes > 20-30 seconds before anything appears. I've never seen that in the previous 5 years of using a Mac. How do I get it to stabilize? – gman Dec 01 '14 at 00:21
  • Do you happen to know a way to rearrange the list in a specific order, or add or remove some applications from the list? – xslittlegrass Aug 25 '15 at 22:26
  • /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user doesn't appear to be working on Catalina. Could this be because the LSHandlers are now written to defaults write com.apple.LaunchServices/com.apple.launchservices.secure? If so, what's the new command to have changes to LSHandlers take effect without a restart? – Janosh Jan 03 '20 at 12:10
  • WARNING: While this command did clean my "open with" list, side effects were a noticeable delay when displaying the list, and also entries disappearing from my "open with" as well as my "share with" list. Fortunately, I was able to cure this by starting my Mac in safe mode. – not2savvy Jun 03 '21 at 20:48
8

CleanOpenWith is an application I created to clean the Open With… menu.

CleanOpenWith is open source and free. The application automates these steps:

  1. Open Terminal: Applications / Utilities / Terminal.app
  2. Type in the following command :

    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
    
  3. Wait for that command to complete

  4. If no error then proceed to the last step, restarting Finder
  5. Restarting Finder does not require you to reboot your Mac. Simply press Control + Option while clicking on the Finder icon in the Dock, select Relaunch and you are set!
Graham Miln
  • 43,776
8

Once you have checked in spotlight to be sure you don't actually have a backup drive or another volume with duplicate copies of the apps (in which case Finder is showing you all the apps that it knows about that can open the file), try running a command to rebuild the launch services database:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Then log out, and log back in again. This should rebuild the Launch Services database for OS X, removing all duplicate entries.

bmike
  • 235,889
daviesgeek
  • 38,901
  • 52
  • 159
  • 203
2

I just had this bite me on a fairly clean, new Mountain Lion install where I had several versions of apps and I think I have a workable idea how the duplicates came about in my case.

I run this Air in clamshell mode and probably pulled it while it was asleep and the launch services database didn't clean up for the apps that were mounted on my external drive connected to my cinema display.

I have a 3 TB drive with several bootable Lion and Mountain Lion installs which correspond exactly for the number of system and third-party apps I have that would be expected to register to open a jpeg file:

Open with...

Just as with the other answers - forcing lsregister to kill the database and kicking Finder patched me up in less than 20 seconds

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain user -domain local -domain system
killall Finder
bmike
  • 235,889
  • This is an old topic, but I ran into the same problem. Simply add your external drive's application folders to the spotlight exclude list: http://superuser.com/a/349054/82434 – evan.bovie Oct 23 '13 at 00:55
  • @emb1995 This problem happens even when you have only one Drive due to a bug in how the App store downloads updates. I don't have a good explanation why Chrome and other non MAS files are duplicated, so perhaps there are more than one bug or a nasty interaction once it starts to corrupt things in the database and the damage spreads. – bmike Oct 23 '13 at 00:59
  • Yeah. I know about the bug, but it looked like everything was working as intended for you, it's just inconvenient for people like us with multiple installs. I might look in to lsregister sometime to find the database and other related code, but perhaps this issue is fixed in Mavericks. I wasn't experiencing that problem with the GM or DPs. Haven't installed the Public Release yet. (odd... I can't mention you in my comment) – evan.bovie Oct 23 '13 at 01:29
1

What cleared this up for me was going to "Force Quit" and then relaunching the Finder.

Problem occurred on a 3 day old iMac totally up to date.

pkamb
  • 8,791
Vesper
  • 11
1

I've run into the issue where there are backups of my apps on an external drive. If I have those drives indexed or launched apps from those drivers, then they show up in the list.

CDK
  • 591