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?
Best Answer
Amigo, I might start with launchctl:
Then check for any impediments to obtaining exclusive lock privilege on the nonexistent database:
Then kill any process reported by either command. Next, run the db generator by hand, preceded by an opensnoop for debugging if something goes wrong. You will need to open a new terminal window ( command key - N shortcut, I believe ) and run opensnoop there, exiting it with a Control Key - c combo.
Then over to your original window type:
Remember to quit opensnoop with a cntrl-c in its window.
F.