I got a MacBook from my work and wanted to use the locate
command, but I get the message:
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.
I ran sudo launchctl
and waited some time... It's been two days and I still see that same message. If I ran sudo launchctl
again I get:
/System/Library/LaunchDaemons/com.apple.locate.plist: service already loaded
Searched for the database and:
$ ls -l /var/db/locate.database
ls: /var/db/locate.database: No such file or directory
The com.apple.locate.plist file is set with the predefined schedule to update on every Saturday at 3:15
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>15</integer>
<key>Weekday</key>
<integer>6</integer>
</dict>
So, it shall update once it was executed for the first time. I'm under Mojave (v10.14.2), new MacBook with SSD and Core i7. locate
should take few minutes to work on new machines, but it's not the case here.
Any ideas on why it isn't working and/or how to make it work?
sudo /usr/libexec/locate.updatedb
in order to build the db earlier. BTW You can usemdfind
command to search for files quicker (It uses Spotlight database).