There have been a few blog posts recently discussing how to clean out the duplicate/old entries in the Open With contextual menu. However, they all give (poor) instructions on how to add an Terminal command-line alias into a .bashrc file. The problem here is that most users are not familiar with the command shell and trying to edit a hidden or non-existent .bashrc file is very confusing. Until Apple fixes this issue, why make it harder on yourself. Here is a method that is more user-friendly using Automator.
UPDATE: Scroll to the bottom of the post to download the Service file and instructions on how to install it.
Open the Automator application.
At the top, change the “Service receives” pop-up menu from “text” to “no input” and in “any application” to “Finder”.
In the Actions Library, select Utilities then drag the “Run Shell Script” to the right hand side. (If you don’t see the Library on the left side, click the Show Library button at the top.)
In the “Run Shell Script” step, delete the “cat” sample command and copy/paste the following code. Make sure it is a single line as I’m sure the blog page will break this into multiple lines. Even in the image below it looks like 3 lines but is actually a single line of code.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
So now whenever you need to clean up the Open With menu, simply go to the Finder menu then choose Services > Clean Open With menu. This will launch the script which will run the lsregister utility.
A few caveats to be aware of when using this utility.
- As some of the other blogs have mentioned, it isn’t necessary to kill the Finder. The lsregister utility can take a few minutes to rebuild the database. Just be patient and within a few minutes, the Open With menu will be cleaned of all the duplicates.
- Resetting the database also means that it no longer knows which applications you have approved to be opened automatically when opening a document. You will be prompted with an “Are you sure?” security prompt the first time you launch an application by opening a related document.
UPDATE: Per a few requests, I’ve zipped up the Clean Open With Menu Service which you can download here. Simply unzip the archive and double click on Clean Open With Menu workflow file. The Finder will ask if you wish to just install the workflow or open it in Automator. Click the Install button and you are all set.