3

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).

sorin
  • 29,875

1 Answers1

2

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

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

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

sorin
  • 29,875
  • 4
    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 00:34
  • Isn't there a way to run this so it is actually synced. Meaning if I delete then things get removed. Also if add, things get added. – mjs Jul 30 '19 at 19:34