Rebuilding LaunchServices to correct general Mac OS X file errors

If your Mac presents small filesystem problems like incorrect icons for documents or displaying deleted applications on your “Open With” menus, you can rebuild OS X’s LaunchServices database to correct them.

To rebuild LaunchServices on Mac OS X 10.4.* (Tiger):

Open a new Terminal window and enter the command below, then wait a few seconds for the processing to finish:

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

To rebuild LaunchServices on Mac OS X 10.5.* (Leopard):

Open a new Terminal window and enter the command below, then wait a few seconds for the processing to finish:

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

Other lsregister Options:

The lsregister utility used in the above commands has several other parameters; if you enter:

/System/Library/Frameworks/CoreServices.framework/Versions/A/
  Frameworks/LaunchServices.framework/Versions/A/Support/
  lsregister

…you’ll be presented with an explanation of all the available options:

lsregister: [OPTIONS] [  < path >... ]
                      [ -apps [,domain]... ]
                      [ -libs [,domain]... ]
                      [ -all  [,domain]... ]

Paths are searched for applications to register with the Launch Service
database. Valid domains are "system", "local", "network" and "user".
Domains can also be specified using only the first letter.

  -kill     Reset the Launch Services database before doing anything else
  -seed     If database isn't seeded, scan default locations for
            applications and libraries to register
  -lint     Print information about plist errors while registering bundles
  -convert  Register apps found in older LS database files
  -lazy n   Sleep for n seconds before registering/scanning
  -r        Recursive directory scan, do not recurse into packages or
            invisible directories
  -R        Recursive directory scan, descending into packages and
            invisible directories
  -f        force-update registration even if mod date is unchanged
  -u        unregister instead of register
  -v        Display progress information
  -dump     Display full database contents after registration
  -h        Display this help

 

Related posts:

  1. Resetting the contextual ‘Open With’ menu in Mac OS X
  2. Exporting your iPhone’s SMS Message Database to a CSV file
  3. Changing the default MySQL root (or other user) password
  4. A Python script to check Google rankings for a specific domain and search term
  5. Displaying a text-based file and folder tree on the command line
Twitter Digg Delicious Stumbleupon Technorati Facebook Email

2 Responses to “Rebuilding LaunchServices to correct general Mac OS X file errors”

  1. Why don’t you just run Onyx?
    It does a lot more than just fix LaunchServices.

    http://www.apple.com/downloads/macosx/system_disk_utilities/onyx.html

  2. Hey Tiaan

    Thanks! Onyx is a great system utility that will delete caches, fix LaunchServices (for which it uses the lsregister utility), repair permissions, etc. I fully recommend that all Mac users should install it on their machines.

    However, if you need a quick fix for the problem above, if you need to customize how LaunchServices reindexes your files, or if you’d like to debug the LaunchServices database, the lsregister utility will be faster and more powerful.

Afrigator