How to trim the Open With contextual menu item


How to trim the Open With contextual menu item
Mac Tip #566, Wednesday, 16 January 2013

When you right-click or Control click a file in the Finder an Open With ‣ menu appears. Select that item and a sub-menu appears filled with the names of apps that could potentially open the selected file. My problem was that the sub-menu contained up to half a dozen duplicates of some of the apps. Confusing? Yes. Annoying? Yes. Here’s how to weed out those duplicates.

Half a dozen each of several apps appear in the Open With submenu.

Half a dozen each of several apps appear in the Open With submenu.

My thanks go to MacRumors where I found this solution to my problem.

Quick Start

  1. Use the Terminal to issue 2 commands (each one on one single line):
    1. cd /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/  
    2. ./lsregister -kill -domain local -domain system -domain user
  2. If necessary, relaunch the Finder.

If this Tip was useful, please leave a comment letting us know. Want more detail? Read the full Tip below.

The duplicates problem

The Open With ‣ menu is really handy, and the Mac magically knows which apps may potentially open your files.

My problem seemed to arise because I’d installed various versions of the apps that were duplicated. After finding the solution I opened the contents of the ./lsregister file in BBEdit, my preferred text editor. I could see that it referred to various versions of apps.

The lsregister file as seen in the Finder.

The lsregister file as seen in the Finder. It’s buried deep inside a nest of folders.

It seems that every time I updated an app a reference to the old one would hang around in that file as a candidate for opening files.

What I needed was a fresh, clean updated version.

A closer look at the menu I saw when trying to open a photo.

A closer look at part of the menu I saw when trying to open a photo. 8 instances of Evernote alone!

Above is a closer look at part of the menu I saw when trying to open a photo.

A Google search found the solution

After some searching I found the solution in the MacRumors Forum.

Since it doesn’t always pay to just blindly follow the suggestions random people on the Internet make, I ferreted around in the listed commands and opened the contents of the lsregister file that seemed to be at the centre of things. [How I did that is way beyond the scope of this Tip.]

That satisfied me that the command probably wouldn’t do any damage.

Check the Open With menu on your Mac

You’ll know if you have this problem as you’ll already be annoyed or mystified by it. But to check:

  1. Open a Finder window to display some files.
  2. Right click or Control click on a file to call up the contextual menu.
  3. Select the Open With submenu.
  4. Try this with different types of files, such as images, text files and others. Each type of file should offer different suggestions.

Use the Terminal commands

To solve the problem you need to paste 2 commands into a Terminal window. Don’t try to type them as the slightest typo could cause it to fail.

Older MacTips have explained where the Terminal is and how to use it. For some extra guidance see A Historic Terminal.

Open the Terminal app and paste in the following command then press Return.

cd /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/  

Then paste the following command and press Return again.

./lsregister -kill -domain local -domain system -domain user

That should fix the problem, if you have it. If not, you may need to relaunch the Finder.

My menu looks better for a bit of pruning.

My Open With menu is tidy again.

My Open With menu is tidy again.

Relaunch the Finder

There are several ways to relaunch the Finder. Here are some:

  • Type killall Finder in a Terminal window and press Return.
  • Hold down the Option (⌥) key while you click on the Finder icon in the Dock, then choose Relaunch.
  • Choose Force Quit… from the Apple menu to call up a window listing running apps, then select Finder and choose Force Quit.
  • Log out and log back in.
  • Restart your Mac.

Please share

Thanks for reading MacTips. Please take a moment to Like them on Facebook, share them on StumbleUpon, Twitter or Google+. It really helps. If you have a website, it’s also useful if you link to MacTips. Just ask me if you’d like a banner.

Related posts

[wpzon keywords="pressure cooker" sindex="PCHardware" snode="1232597011" sort="salesrank" listing="8"]

5 Comments

  1. Alistair McBride said:

    Works like a charm and hey presto a clean menu!

  2. Sushi said:

    Thanks, the commands worked like a charm. I love this website.

  3. Michael said:

    Thanks, this has been bothering me for a wee while.

  4. KiwiGraham said:

    It’s perhaps worth noting that what one is dealing with here is the “Launch Services” database. The command noted above erases that database and it is then rebuilt based on current apps. If one doesn’t like using Terminal commands there are various utilities, such as the free Onyx, that include this functionality via “point & click”.

Comments are closed.



Top