update locate database for Mac Os X

Jun 05, 2008 Mac OS X

Here's one of those little things I do frequently, but never remember the command.

The 'locate' command searches a file name database that is updated weekly (I think the default update time is 4:30 am every Saturday morning, but only if your Mac is switched on then, which mine never is).

If you try to run 'locate' on a database that isn't current, files created more recently than the last update will not be found, and deleted files will be found erroneously.

To update the database manually use the following command:

sudo /usr/libexec/locate.updatedb