Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Automatically update locate db on-demand' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automatically update locate db on-demand
Authored by: Hal Itosis on Oct 09, '11 06:08:02PM
I can't speak for Lion, but some of these comments about Leopard & Snowy don't seem right...
Rebuilding the database is no longer part of the weekly maintenance script. The launchd trigger, stored in /System/Library/LaunchDaemons/ as com.apple.locate.plist and was supposed to launch at 3:15 AM on Saturdays, has been disabled. So, if you want to rebuild the database, you have to do it manually.
...or, simply re-enable the automatic task. In fact, when a user attempts to use locate on a virgin Snow Leopard machine, they are presented with this message in Terminal:
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.
So, simply follow those instructions (as i have), and Snow Leopard will do the whole weekly "Unix maintenance" task routine, just as Leopard did.


The locate.updatedb executable is crippled, excluding some system-level items. To rebuild it so nothing's missing, you need to replace the current locate.updatedb executable with the uncrippled one from Leopard, located in its /usr/libexec/ folder, assuming that you still have an early Leopard installation or installer. I believe it was crippled in 10.5.5 (one dated 12/12/08 or earlier will work uncrippled).
Again, it all works fine in Snow Leopard. And locate.updatedb is not "crippled" (at least not on my 2010 Core i7 MBP running 10.6.8):
$ ls -l /usr/libexec/locate.updatedb
-r-xr-xr-x  1 root  wheel  3449 May 18  2009 /usr/libexec/locate.updatedb
As can be seen, the mod date there is 2009... and as i say, it all works fine.


Supposedly, Apple crippled it as a security measure,
I hadn't heard that (what/where is your source?). If i had to guess, Apple probably disabled it so that non-Unix folks (who don't use locate on the command line) wouldn't worry about the occasional mysterious background activity, or wonder what's loading down the CPU, etc. For geeks who care, that message we see when attempting to run locate instructs us how to re-enable the weekly rebuild (as i mentioned above), and so they can it get up and running in seconds.

-HI-
Edited on Oct 09, '11 06:10:46PM by Hal Itosis


[ Reply to This | # ]