On my Mac the 'Open With' list in the context menu keeps filling up with duplicate entries for apps. Not really sure why it keeps happening but I keep forgetting how to clean it and then not being able to find the solution again.

So this is how to do it:

Enter this into terminal (this is on 10.8 the file path might be different on other version of OS X):

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

I have also created an alias for this in my bash profile:

alias cleanopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'