MacOS – Locate tool won’t work, how to fix

macosterminal

I was trying to update the locate database, but when input sudo /usr/libexec/locate.updatedb, I got a bunch of errors. When I try to use locate again it would not work. I can’t remember what I did, but I ended up finding out that the locate.updatedb file had been corrupted. I got locate to work again by using Time Machine to recover the locate.database file. But I want to be able to update locate without corrupting the file. How do I fix this?

Best Answer

Open Terminal.app and run the following two commands:

cd /
sudo /usr/libexec/locate.updatedb

The "cd /" part is important as you need to be in a path where the user "nobody" has permissions.