Remove Duplicates from the “Open With” Right-Click Menu in Mac OS X

Jan 22, 2013 - 32 Comments

Fix the Open WIth menu and remove duplicate app entries

The “Open With” menu appears when any file in the Mac Finder is right-clicked (or control-clicked), and it is intended to provide a list of alternate apps that selected file can be opened with other than what is currently set as the default application. This Open With is great, but sometimes it can become freakishly cluttered with repeat entries of the same app, and in the worst cases it won’t even just be a duplicate here and there, it will be multiples of the same app appearing in the Open With list. We’ll show you how to remove these repeat entries and how to make an easier to use alias for future uses.

Remove Repeat App Entries in “Open With” Menu of OS X

This should work with just about every version of Mac OS X

  • Launch Terminal from the /Applications/Utilities/ directory and enter either one of the following command string onto a single line:

Copy & paste from single line command string:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"

OR

Same command string broken into multiple lines:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/\
lsregister -kill -r -domain local -domain user

(Note: the backslashes within the second command are used to extend long commands to multiple lines while still making them executable when copy & pasted, they are not necessary to include if you are manually typing the command string into the terminal)

This may take a while as the entire Launch Services database has to be rebuilt, and in that rebuilding process is where the duplicate app entries will be removed from the right-click menu. Once this is finished, you must then quit and relaunch the Finder for the change to take effect, that is easiest to do from the command line as well:

killall Finder

Now when Finder has relaunched, go back to any file and right-click on it, pulling down the “Open With” menu to see all repetitive entries gone.

Remove Open With Menu Duplicates in OS X

But what if you have to do this often, that command string is kind of annoying huh? Here’s how to shorten it dramatically:

Creating a Short “Remove Open With Duplicates” Alias

If you find yourself having to do this more often than you’d like, creating a simple bash alias for the entire command sequence can be a significant time saver since it will remove the need to enter a lengthy series of command strings.

  • Open .bash_profile with your favorite text editor, we use nano for this walkthrough because it’s simple:
  • nano .bash_profile

  • Paste in the following alias onto a single line of .bash_profile, rename the alias if you feel like it
alias fixow='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"'
  • Hit Control+O to save, then Control+X to exit nano

Verify the alias worked by typing ‘fixow’ at the command line, though if you already cleared Open With it won’t have the same effect. If you used the exact command string as above you’ll get a little message echoed back at you, looking like this:

$ fixow
Open With menu has been rebuilt, Finder will relaunch

If for some reason you have trouble grabbing that code, you can also copy it from the OSXDaily GitHub page, where we are starting to collect some particularly useful shell scripts for OS X.

This allows you to simply type ‘fixow’ (short for Fix Open With, get it? We sure are creative) and that entire command string will execute without having to type the entire thing again.

Can I Remove Every App From the “Open With” Menu?

If your issue is beyond the duplicate or repetitive entries, the other option is to clear out the entire Open With menu and start from scratch. This takes everything out of the menu, forcing you to manually associate apps with file types and formats on your own or just by using OS X to open particular files. That’s really a method of last-resort, or for uber-customization if you want to rebuild the list yourself and be more selective with the associations.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks, Troubleshooting

32 Comments

» Comments RSS Feed

  1. Kevin Roa says:

    This no longer works. Any suggestions on what does now with MacOs 10.13.4?

  2. Mr. Nasser says:

    thank you about that MR. Paul Horowitz,,that is great,,it’s work with me.

  3. Kevin Roa says:

    Seems crazy after all these years you still have to do this periodically.

  4. Matty says:

    Thank you so much! The cut and paste option was so easy!

  5. Matt says:

    Thank you so much….great, accurate and useful information to a much frustrated user!

  6. Nasser says:

    thank you it’s work with me,,,,the first option [removing the duplicated app in the right click drop list],,,thank you ones again and may the great lord reword you for that.

  7. Svet says:

    Nice, Thanks!

  8. Rich W. says:

    Love this tip, as a large “Open With” menu would cause my contextual menu to hang a bit as the entire menu loaded. This is difficult to avoid given the natural path the cursor has to travel. For a simple png file, my menu was reduced from 39 items to a faster-loading 19.

    However, my Firefox is still showing 7 duplicates. Any idea what Firefox is doing differently than other apps to cause this? Any other ideas on how to stop Firefox from showing so many versions in “Open With”?

    Firefox supplies versions very often, sometimes twice a month, so their app list will soon become quite long.

  9. Monty says:

    After I ran this script some features of other programs stopped working. For instance, when I download something in Google Chrome and click the icon that appears on the lower bar of the browser nothing happens.

    When I attempt to click any type of link within apps that are supposed to bring up the location of something in the Finder, nothing happens. I have to manually navigate to the location of the file.

    Not sure if there is a reverse for this command, or if there is a way to fix my issue, but I mind this more than I mind having a few duplicates in the contextual menu.

  10. Adam says:

    I ran this script and it worked for me – duplicates were removed. However, it also removed some that I use regularly (programs runnings within Parrallels).

    Any idea how to add entries to the open with list?

  11. Adriano says:

    I build a small app to put on Startup items, follow the link to anyone who wants:

    https://github.com/AdrianoMartins/FixOpenWithMenu/raw/master/Binary/FixOpenWithMenu.app.zip

  12. ice says:

    Thanks, works great!

  13. C says:

    Thank you! very helpful

  14. BT says:

    Just acquired this issue this past week and am glad I came across this tip. Thanks!!!

  15. Br.Bill says:

    This has been bugging me for a while — ever since I upgraded to Lion and now through Mountain Lion. Thanks for the fix.

  16. Eric says:

    An even easier way to do this is to use Onyx, the free utility. It will rebuild the database for files and associated apps by simply clicking a button.

  17. jyoseph says:

    This is killer! That always bugged the heck out of me.

    I used automator to turn this into a service: http://i.imgur.com/dO4j9P2.png

    So now I can go to my top menu e.g. Finder > Services > Remove Open With Dupes

    Thanks for the great tip!

  18. thnx says:

    I was waiting for this command fix from a long time!!!, Thanks!!

  19. Tim says:

    So, how can I clean up Mail.app’s “Open With”-Menu, like remove items and sort alphabetically?

  20. Theo Vosse says:

    Nice one, thanks.

  21. jon says:

    Brilliant, thanks. That’s been bugging me for a long time.

    Also, if you get just the “command not found” response, exiting & restarting Terminal may fix it.

  22. James Ludtke says:

    I can create the script and save it, but it did not run. First I got “-bash: fixow: command not foundI” then I got a permission error.

    Adding a prefix to the script:
    #!/bin/sh

    and a suffix:
    chmod ugo+rwx fixow

    and the script executed OK.

  23. banger says:

    Thanks… this was useful…

  24. Scott says:

    This is better:

    /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -all s,l,u; killall Finder

  25. Roy says:

    Useful, thanks!

  26. Oleh says:

    Thanks, this is useful.
    IMO the reason of the issue is that OS X treats every version of the app as a different one.
    I had tons of Textmates and Sublimes.

    • Paul says:

      I believe you are right, it seems that every time an app is updated either though the Mac App Store or directly from an app itself, it adds another entry. This is easy to replicate with App Store updates in particular. Seems like a simple bug and there should be a fix in future OS X updates.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site