Tuesday, April 23, 2013

Rebuilding the Launch Services Database

Craig Hockenberry:

So, the next time you’re seeing general slowness on your Mac, don’t forget to give Launch Services a kick in the pants. Guaranteed to be more effective than zapping your PRAM.

The current command is:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed -r

If you don’t remember the latest path to lsregister, Rich Siegel recommends using locate (although that requires that the locate.database be in order).

6 Comments RSS · Twitter

You can also use 'mdfind' to find the path to lsregister. It doesn't require you build the locate database ;-)

@John That’s interesting. I was able to find it using mdfind -name lsregister. I would not have expected this to work since Spotlight is usually useless for finding files in the System or Library folders.

It looks like Spotlight no longer excludes anything much by default. This may have started in Lion when it looks like Spotlight's storage format changed. I still have Spotlight disabled on my 10.6 MBP so I never even try these kinds of things, but on an otherwise-unmolested 10.8 box I can even find stuff in /private.

@Nicholas I guess Spotlight is indexing more stuff, but when I search via the Spotlight menu or the Finder it still doesn’t show me results from ~/Library, /System, or /private.

"It looks like Spotlight no longer excludes anything much by default. This may have started in Lion when it looks like Spotlight's storage format changed. I still have Spotlight disabled on my 10.6 MBP so I never even try these kinds of things, but on an otherwise-unmolested 10.8 box I can even find stuff in /private."

FWIW, since I'm Snowy, Spotlight does scan ~/Library and /System, but does not scan /private.

"I guess Spotlight is indexing more stuff, but when I search via the Spotlight menu or the Finder it still doesn’t show me results from ~/Library, /System, or /private."

Spotlight has always had the strategy of hiding things by default in the UI that are available via mdfind.

But, at least in Snowy, you certainly can get Spotlight results from ~/Library and /System in the Finder, though not from the menubar.

There is a 'search attribute' of "System files", which is toggled off by default in Finder searches. And you can create a Saved Search with that attribute turned on, and/or add that attribute to your favorites.

Leave a Comment