Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
show 1 more comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
3  
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
add comment

Your Answer

 
discard

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.