Clean up the “Open With” menu on OS X

I have what I guess may be a bad habit of installing all the new software I come across, tinkering with it and then removing it.  Unfortunately there are a lot of times doing this can clog up your “Open With” menu on OS X.  I have noticed even using some nightly builds of software will really clutter it up.

When that starts to happen you can use the following snippet to clear all the dupes, as well as restart finder.

/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"