10.5: Get locate to index the Time Machine drive

Nov 16, '07 02:31:00PM

Contributed by: robg

I'm a big fan of locate, even in this day and age of Spotlight; it's a super-fast way to find things in Terminal (with the downside that it needs updates to remain current, as it's a static index of file names). By default in 10.5, locate won't find files on Time Machine drives -- this is probably a good thing, as it greatly increases both the size of the database and the number of returned matches.

However, I was working on a project, and I wanted this information in locate. The solution is pretty simple: you need to edit /usr/libexec/locate.updatedb (with sudo). Look for this line:

: ${PRUNEPATHS:="/tmp /var/tmp */Backups.backupdb"} # unwanted directories
Edit it to remove the */Backups.backupdb bit, then save your changes, quit the editor, and update the database (sudo ./locate.updatedb from that same directory).

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20071116143041236