Mac OS X ‘open’ command

If you work with the command line often, you may find the open command useful.

open will launch the program associated with a file, as determined by LaunchServices. For example, to open all .c files in the current directory:

open *.c

It can also be used to open Finder to a particular directory. For example, to open Finder to the current directory:

open .

Duplicates in Mac OS X “Open with…” Finder menu

I’ve read several blogs and forums online describing how to fix the problem of duplicate or old entries in the “Open with…” contextual menu in Mac’s OS X Finder.  The problem with some of these sources is that the path listed is not always correct, rendering the ol’ copy-and-paste standby useless.  One easy way to handle this is with the locate command.

To rebuild the list of programs under the “Open with…” menu, from a Terminal shell, copy/type:

`locate lsregister` -kill -domain local -domain system -domain user

Note the ` [backward apostrophe] is the key shared with the ~ [tilde or “twiddle” in unixspeak].  This should not be run as the superuser, but rather as your own login.

This could potentially fail if you have more than one lsregister installed on your system, but that shouldn’t be the case with a default install.

You may need to logout and log back in for the changes to be seen.