我正在使用 Mac(Catalina,10.15.7)并想使用locate <...>
-command。输入后locate ...
,我建议了以下内容,我做到了。
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.
创建数据库后,我想执行locate
- 命令。这没有按预期工作。相反,这出现了:
locate: locate database header corrupt, bigram char outside 0, 32-127: -1
我能做些什么来解决这个问题?非常感谢你的帮助。
您可以尝试删除(或移动)locatedb 文件,例如
mv /var/db/locate.database /var/db/locate.database.backup
,然后使用/usr/libexec/locate.updatedb
. 您将需要使用sudo
这些命令:sudo mv /var/db/locate.database /var/db/locate.database.backup
sudo /usr/libexec/locate.updatedb