Wednesday, March 27, 2024
spot_img

Remove duplicate entries in Open With menu

For years now I’ve been having trouble with duplicate entries appearing in the Finder “Open with…” menu. Sometimes it can end up with 4 or more entries for the same application.

I just cleaned mine up, so unfortunately I can’t post a screen shot of what it looks like. There are many ways to go about fixing this issue. I went with the more technical one, because I like to get into the system and learn things about it. But that’s not everyones’ cup of tea. So I provide many other options below. Be sure to read through this whole post so you can go with the method you feel most comfortable with.

Using Terminal.app to remove the duplicate entries in the Open With menu

Without getting into technical details and explanations, here’s the hands-on way to fix this issue yourself.

1. In Finder, go to View >> Show System Files (make sure that menu option is ticked, as you’ll need to see hidden system files)

2. In Finder, click on your Home folder. That’s the one named after you, or whatever your Mac OS X Username is. Take a look for a system file called .bash_profile

If it does not exist, you’ll create it in the next step. If it does exist, open it in TextEdit or any other text editor you like to use.

3. Open TextEdit (or your preferred text editor). e.g. Command-space (to pull up Spotlight), type in “textedit” (without the quote marks), make sure the TextEdit app is showing and highlighted, hit return.

4. Paste the following into the text editor:

# An alias comment to rebuild the Launch Services database and remove
# all the duplicates in the Open With context menu in Finder.
alias dedupeopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'

5. Save the file to your Home folder. Give it the name:

.bash_profile

6. Open Terminal.app. e.g. Command-space, type “Terminal“, hit enter

7. If you are simply following these steps, it’s likely you’ll need to enter following at the command prompt in Terminal. Just type or copy/paste the following:

source ~/.bashrc

8. Issue the command. Type the following into Terminal

dedupeopenwith

9. Leave Terminal open for now. In Finder, check your Open With menu. If there are still duplicate entries you’ll need to type the the following into Terminal:

killall Finder

Finder will restart and refresh itself.

By the way: If you use a Finder add-on such as Total Finder, you’ll need to restart Total Finder (command-space, then type into Spotlight, “total finder“, and hit return)

Steps 2 to 5 alternative

An alternative (and quicker option) to using TextEdit is to use the command line pico editor. At Step Two simply open Terminal.app. Type in:

pico ~/.bashrc

If the file does not exist, pico will create it. Note the if your Terminal window is small, the last line of text from what you paste into pico may look odd, as though it was cut off. Here is a screen shot showing what I mean:

Paste in the text from Step Four. Then hit Control-x. It will ask if you want to save the changes. So hit Y for Yes to save. If the file didn’t exist, it will prompt you to confirm the name. It should already be showing .bashrc as the name. Hit Return key. Done. Leave Terminal open.

Now continue with Step Seven.

That’s it. You should now see that all duplicate entries have been removed from Finder’s Open With… menu.

Many Other Options for removing duplicate entries

If you don’t like getting your hands dirty in Terminal with commands, etc. here are a few other options.

TinkerTool: There’s a free app called TinkerTool. It’s available for download HERE. It has an option to rebuild the LS database. It’s quick and easy, if you prefer doing things that way.

Text Expanders: If you have a text expander such as the ones listed in my article on how to automate inserting the Command symbol, you could add the following to a new keyword. Make sure it’s a keyword are not likely to type inadvertently. Something like ~dedupeopenwith

Link the following text with the keyword:

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

This will run the command that the dedupeopenwith alias was created to run for you. It will also restart Finder to make sure the changes take immediate effect.

Keyboard Maestro: If you have Keyboard Maestro, Matt Henderson has created a macro for KM to perform the Open With repair. You’ll find that here…

Automator Service: Jeff over at Insomniac Software provides great instructions on how to set up an Automator Service for this task .He even provides the service as a download, ready-made. Read about it here.

Enhanced by Zemanta

Recent Articles

spot_img

Related Stories

1 Comment

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox