Remove Duplicates from the “Open With” Right-Click Menu in Mac OS X
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"
Same command string broken into multiple lines:
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:
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.
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:
- 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:
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.
This no longer works. Any suggestions on what does now with MacOs 10.13.4?
thank you about that MR. Paul Horowitz,,that is great,,it’s work with me.
Seems crazy after all these years you still have to do this periodically.
Thank you so much! The cut and paste option was so easy!
Thank you so much….great, accurate and useful information to a much frustrated user!
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.
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.
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.
Restart fixed my issue.
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?
I build a small app to put on Startup items, follow the link to anyone who wants:
Just ran it on Big Sur. It works!
Thanks, works great!
Thank you! very helpful
Just acquired this issue this past week and am glad I came across this tip. Thanks!!!
This has been bugging me for a while — ever since I upgraded to Lion and now through Mountain Lion. Thanks for the fix.
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.
I’ll second Eric’s tip about Onyx:
But this is a great way to do it via the Terminal.
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!
Thanks for the Automator tip. Gotta love all the power you get in Mac OS X right out of the box. :)
I was waiting for this command fix from a long time!!!, Thanks!!
So, how can I clean up Mail.app’s “Open With”-Menu, like remove items and sort alphabetically?
Nice one, thanks.
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.
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:
and a suffix:
chmod ugo+rwx fixow
and the script executed OK.
Thanks… this was useful…
This is better:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -all s,l,u; killall Finder
Why is that better? Slightly shorter lsregister path, kills finder, but otherwise what is the difference?
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.
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.