-1

Over the past few operating systems I've been noticing a trend, especially after Apple screwed around with the real and fake "root" user in El Capitan. Most especially, using the locate command. Whenever I try to update using the conventional:

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

Which is prescribed by Apple when the locate command fails. I've managed to use mdfind but prefer locate because I'm looking for files in the ENTIRE system and I don't care about keywords inside of files like MDFind echos, see here for more evidence of locate working better for this task than mdfind MDfind vs Locate. Thanks everyone, I will continue tinkering for now.

1

After quite a bit of tinkering and waiting to delete my question prior to posting an uneducated question, I found an old OSXDaily article that suggests another way to update the Locate DB. The command suggested is: sudo /usr/libexec/locate.updatedb And searching for that command rather than the com.apple.locate.plist setup in launchd, I found this lovely article about changing the database update frequency. I however, took a somewhat different approach to updating the database, simply by adding a line to my daily crontab:

env EDITOR=nano sudo crontab -e

0 12 * * * sudo /usr/libexec/locate.updatedb.

ctrl+x y [ENTER]

Thanks, I hope this helps someone going through the same annoying crap.

1

When running sudo /usr/libexec/locate.updatedb the script would toss this error:

    shell-init: error retrieving current directory: getcwd: cannot access 
parent directories: Permission denied find: 
.: Permission denied

I tried enabling root login but the script had the same behavior.

I found I can get locate to search almost everywhere by modifying /usr/libexec/locate.updatedb.

Change:

if [ "$(id -u)" = "0" ]; then

to,

if [ "$(id -u)" = "1" ]; then

There is some reduction security but as far as I read if this is for your personal computer you should be alright. Here are some links providing different tests and solutions:

https://superuser.com/questions/161183/cannot-manually-update-database-for-locate/161558

https://superuser.com/questions/237014/what-folders-are-indexed-covered-by-locate

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .