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 am looking for a bash set of commands that will enable me to schedule the execution of /usr/libexec/locate.updatedb once every day.

Please respond only with a set of command line commands, because I want to include this in a "setup" script (in order to be able to reuse it when I go to another machine).

share|improve this question
Or use the deprecated cron. – user588 May 26 '11 at 17:55
May I ask why you're using slocate instead of Spotlight? (At the command line: mdfind) – Jason Salaz May 26 '11 at 20:41
Just because it's the same an on other Unixes. – sorin May 26 '11 at 22:29
Depending on the OSX version, it should be rebuilt weekly. Look in /etc/periodic/weekly. You should find (on 10.5.8) 310.weekly. This rebuilds the locate database. – user14537 Dec 4 '11 at 15:22
up vote 1 down vote accepted

After additional (re)search I found an easy solution:

sudo launchctl load -w /System/Library/LaunchDaemons/

This is also persistent, so it will run updatedb daily.

share|improve this answer
This only runs locate.updatedb weekly (every saturday morning at 3:15am). If you want it to run daily, remove <key>Weekday</key> <integer>6</integer> from the StartCalendarInterval dictionary in that plist file (then unload and reload it). – Gordon Davisson May 27 '11 at 0:34

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.