现象
在macOS上使用locate命令查找文件的时候,报错如下:
$ locate jdk
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.
按照系统的提示,使用sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
这个命令,提示如下:
$ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
Password:
/System/Library/LaunchDaemons/com.apple.locate.plist: service already loaded
然后再次使用locate命令,仍旧是提示上面的错误,db不存在。
解决方法
使用命令sudo /usr/libexec/locate.updatedb
,直接更新locate的db,等几分钟后再使用locate命令。
原文地址:https://www.cnblogs.com/yuxiuyan
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。