Last Updated: October 16, 2018
·
3.125K
· paolodt

Rebuild the launchservices database

Using the Mac OSX system, it happens now and then that when you control-click on a file to use the Open With contextual menu, you'll see double entries, and even removed applications, in the list of available applications. A rebuild of the LaunchServices database is then the solution.

With Leopard (10.6.x) and later system, use the following command line:

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

(note: it is just one line)

To make it a bit more handy, you may take in consideration to create an alias in your environment. Edit your $HOME/.profile file and append the following entry:

alias lsrebuild='<the above command>'

Obviously replacing the string <the above command> with long /System/Library/... statement in the previous paragraph.

Doing that, you will able to fix your context menu just typing lsrebuild in your shell terminal.

That's all!