Duplicate entries in Mac OSX "Open With..." - Bash Script
If you're like me, you probably install-test-remove a plethora of apps on a weekly basis. One of these annoying issues that pop up on Mac OSX is the duplication of apps in the "Open With..." menu. Let me show you what I mean. Here I am, trying to edit a Python script.
Fortunately, the solution is easy. The "Open With" dialog is controlled by OSX's LaunchServices framework. Create a shell script in your path - let's call it "FixOpenWith". Put the following text in your new file.
#!/bin/bash
echo 'Now removing duplicates in the "Open With" menu in Mac OS X'
/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"
Next, using Terminal, cd to the file you just created. Type chmod +x FixOpenWith to make it executable. Then run it: ./FixOpenWith. If the script is in your $PATH, you can just leave off the leading ./ This will take a few seconds or happen immediately, depending on your system.
Your Finder window should re-open and your issue will disappear.
Output in your terminal:
# ./FixOpenWith
Now removing duplicates in the "Open With" menu in Mac OS X
Open With has been rebuilt, Finder will relaunch
Voila!
-A
Fortunately, the solution is easy. The "Open With" dialog is controlled by OSX's LaunchServices framework. Create a shell script in your path - let's call it "FixOpenWith". Put the following text in your new file.
#!/bin/bash
echo 'Now removing duplicates in the "Open With" menu in Mac OS X'
/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"
Next, using Terminal, cd to the file you just created. Type chmod +x FixOpenWith to make it executable. Then run it: ./FixOpenWith. If the script is in your $PATH, you can just leave off the leading ./ This will take a few seconds or happen immediately, depending on your system.
Your Finder window should re-open and your issue will disappear.
Output in your terminal:
# ./FixOpenWith
Now removing duplicates in the "Open With" menu in Mac OS X
Open With has been rebuilt, Finder will relaunch
Voila!
-A
Thanks a lot for this help!
ReplyDelete