Problems encountered when using locate in mac

System version: MacOS High Sierra (10.13.6)

Cause of the problem:

I want to quickly find the address where the nginx.conf file is located. According to the query, I found that the locate tool can be used. So the operation is as follows:

locate nginx.conf

Get the following warning 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.

Solution:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Continue to use and find that the above operation does not take effect. Solution: update the library

sudo /usr/libexec/locate.updatedb

The above operation is a bit time-consuming, I interrupted the operation with ctrl+c, and then used the locate command, which caused the following warning:

locate: locate database header corrupt, bigram char outside 0

Solution: Continue to update the library and wait for the operation to complete correctly.

reference:

Problems with locate after Homebrew update on Mac

WARNING: The locate database (/var/db/locate.database) does not exist.

How to quickly view configuration files in nginx

Guess you like

Origin blog.csdn.net/u010682774/article/details/111197068