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.