Quick Tip: Removing Duplicates in 'Open With' Using Terminal

If you're like me, you'll notice that things start to get messy on your Mac after a while if you aren't super organised. The desktop gets full of files, and your folders can easily get into a bad state; but what really tells me I need to sort things out is when my right click option for Open With gets crammed with all sorts of useless junk.
In this tutorial I'll show you a very easy way to stop your Open With list showing duplicates and apps you no longer have.

The Problem

If you tend to install and uninstall apps fairly often, like I do, you can get left with an option to Open With apps you haven't even got on your Mac anymore, or even more frustrating, multiple entries of the same app. This problem can also arise if you use virtual machines like Parallels or WMWare that can leave behind data from uninstalled apps. Does this look familiar?
long list
Things getting out of hand
The problem here is that the Launch Services database is full of unwanted apps, and I want to rebuild it. So to do this involves using the Terminal quickly.
Note that you can use apps like Cocktail or Onyx for this, but when it can be done so simply by yourself I recommend following this method.

Step 1. Open Up Terminal

Blank Terminal

Your Terminal should look similar to this
First thing you need to do is open up Terminal, which is where your Mac processes commands that you can give it. It is located in /Applications/Utilities or just do a spotlight search for it. Don't get scared if you've never done this, it may look like a bunch of gibberish to you, but that's fine. Terminal is a very powerful tool, but if you follow what I instruct you to do, step by step, you should have no trouble.

Step 2. Enter the Code

Terminal with Code
Enter the code and press return
Now that you've got your Terminal open it's time to enter the code. Now it's simply a case of copying and pasting the code below into Terminal, and hitting the enter key.
1
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Hopefully you have something that looks like the screenshot above. We're done with Terminal now, so you can close the app.

Step 3. Relaunch Finder

Relaunching Finder
Relaunching Finder
To allow the changes made to take effect I need to relaunch Finder. Unlike normal apps you can't simply cmd-Q Finder to quit it, but fortunately the solution isn't much more challenging. While holding the alt key, right click on the Finder icon and select Relaunch.

Result

No duplicates!
No duplicates!
What I have done in this Quick Tip is to reset the Launch Services database using just Terminal, and now when you right click on a file to open it, there should only be one version of the apps that open this kind of file. Doesn't that look better!? There's no longer the confusing multiple entries and you should be able to get on with doing what you wanted to do in the first place - opening files, without distraction. Hopefully now you can enjoy using a slightly cleaner Mac. Feel free to let me know in the comments if you have any similar tricks.

Unknown

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

 

Copyright @ 2013 KrobKnea.

Designed by Next Learn | My partner