Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the locate command in Terminal regularly. When does its database get updated? On other systems, I could run updatedb as root to force it to update.

Note: I know using mdfind to search with spotlight is another option

share|improve this question
up vote 3 down vote accepted

The locate database is updated by the following cronjob:


On Most Mac systems, Cron has been replaced by launchd, and you'll find that /etc/crontab doesn't exist. The schedule for this scheduled job is determined by launchd, and can be seen with one of the following commands:

% cat /System/Library/LaunchDaemons/
    #### SNIP

Or, something a little more user friendly:

% open /System/Library/LaunchDaemons/

launchd will then run the jobs specified in /etc/periodic/{daily,weekly,monthly}/*, using this schedule.

share|improve this answer
tl;dr version: Saturdays at 3:15 AM local time. – Chealion Oct 6 '10 at 22:38
Or if the mac is sleeping at 3:15 AM Saturday morning, when it wakes. – bmike Jun 10 '11 at 0:02
Yet another way to see the contents of the plist: defaults read /System/Library/LaunchDaemons/ – Harald Hanche-Olsen Jun 10 '11 at 16:26

sudo periodic weekly is the easiest way to kick it off the weekly script which will call the normal rebuild of the locate database.

As noted launchd will start this script Saturdays at 03:15 AM if the mac is running. If the mac is sleeping at that time, it will run when the mac wakes. It won't run if the mac is powered off at the magic moment.

share|improve this answer

From the locate manpage:

 /var/db/locate.database          locate database
 /usr/libexec/locate.updatedb     Script to update the locate database
 /etc/periodic/weekly/310.locate  Script that starts the database rebuild

By default, the database is rebuilt weekly through launchd. You can run locate.updatedb manually to do the update.

share|improve this answer
On most Mac systems, cron is replaced by launchd. There is no /etc/crontab by default, for example. That was moved to launchd. – Stefan Lasiewski Oct 6 '10 at 17:33
@Stefan - Your right. I forgot about that change, which Apple did in Tiger. – KeithB Oct 6 '10 at 18:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.