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.

2 Answers 2


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.


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.


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


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:



  • What version of MacOS are you running btw? I haven't yet experienced this problem (not looking forward to experiencing it either haha..).
    – Tmanok
    Oct 7, 2019 at 21:42
  • Update: I began to notice this after upgrading to Catalina and onwards. Thanks for this info Benjamin!
    – Tmanok
    Apr 19, 2023 at 2:26

You must log in to answer this question.

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