How to update the locate db in macOS Catalina?

This command always used to work:


sudo /usr/libexec/locate.updatedb


Now it produces a string of errors:


% sudo /usr/libexec/locate.updatedb


Password:


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


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


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



MacBook Pro with Touch Bar

Posted on Nov 25, 2019 2:27 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 25, 2019 7:25 AM

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


This Terminal command works on Catalina 10.15.1 from the zsh shell. I would wait a few minutes before attempting to use the command-line locate command as it takes awhile to generate the locate database in /var/db. Locate now works for me in Catalina, but do check its manual page:


man locate


Similar questions

2 replies
Question marked as Top-ranking reply

Nov 25, 2019 7:25 AM in response to brsm1990

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


This Terminal command works on Catalina 10.15.1 from the zsh shell. I would wait a few minutes before attempting to use the command-line locate command as it takes awhile to generate the locate database in /var/db. Locate now works for me in Catalina, but do check its manual page:


man locate


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to update the locate db in macOS Catalina?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.