mac中使用locate遇到的问题

系统版本:MacOS High Sierra(10.13.6)

问题起因:

我想要快速查找nginx.conf文件所在的地址,根据查询,发现可以用locate工具。于是操作如下:

locate nginx.conf

得到如下警告1:

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 /usr/libexec/locate.updatedb

上面操作有点耗时,我用ctrl+c打断了操作,再使用locate命令,从而引发了下面警告:

locate: locate database header corrupt, bigram char outside 0

解决办法:继续更新库的操作,等待这个操作正确完成即可。

参考:

Problems with locate after Homebrew update on Mac

Mac 下locate命令使用问题WARNING: The locate database (/var/db/locate.database) does not exist.

nginx快速查看配置文件的方法

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值