5

I am trying to use the locate command because even though I installed postgresql, psql is not recognized on command line:

$ locate psql | grep /bin

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

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

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

So I run the command:

$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
com.apple.locate: Already loaded

Output:

$ ls -l /var/db/locate.database
-r--r--r--  1 nobody  wheel  11096658 Mar 25 14:29 /var/db/locate.database

If it is already loaded, then why is it telling me to create the database? I already created it. How can I get locate working?

3
  • Please be aware that the database can take some time to generate. Also, can you add the output of ls -l /var/db/locate.database to the question?
    – nohillside
    Mar 25 '16 at 18:27
  • @patrix I added the output Mar 25 '16 at 18:41
  • Hi Donato, I'm experiencing the same problem with Sierra. My system started with Mavericks long ago however.
    – Tmanok
    Oct 22 '18 at 22:29
6

You can update the database used by locate manually by running

sudo /usr/libexec/locate.updatedb       

You must log in to answer this question.

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