Saturday, January 26, 2008

Apple Mac OSX - locate command fails

On my new MacMini I needed to use the 'locate' command but I got

'locate: `/var/db/locate.database': No such file or directory'.

To fix this is to manually run the weekly CRON job:

$ sudo periodic weekly

or, you can run

$ sudo /usr/libexec/locate.updatedb

and then locate should work OK.

Update: On a Leopard machine you will get a warning if you run the latter command:

">>> WARNING
>>> Executing updatedb as root. This WILL reveal all filenames
>>> on your machine to all login users, which is a security risk."

If you are the sole user of the machine, this will be OK. If you are not, consider your options. On OSX pre-Leopard you don't get this warning of course.

1 comment:

Anonymous said...

Thanks alot!
I've been wondering how to update.