locate & updatedb - files not found

Solution 1:

Try:

sudo /usr/libexec/locate.updatedb

And look config:

/etc/locate.rc the configuration file

Edited:

Post here output:

echo $LOCATE_CONFIG

And:

cat /etc/locate.rc

And:

echo $0

Update:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man1/locate.1.html#//apple_ref/doc/man/1/locate

The locate program searches a database for all pathnames which match the specified pattern. The data-base database base is recomputed periodically (usually weekly or daily), and contains the pathnames of all files which are publicly accessible.

Try mdfind instead locate

Updated2:

mdfind -name text which is more accurate. Just mdfind text gives you files that contain text as well. – David Krmpotic

mdfind -name text

Solution 2:

Permissions may be the culprit as locate apparently cannot read files that are not world readable. See this answer by Plundra for more explanation.

The findutils package from homebrew does enable gupdatedb and glocate commands that seem to overcome some of the limitations of the builtin utilities.

Solution 3:

If you want to search the same database that Spotlight uses, you can use the mdfind command as an alternative (although not an exact replacement) for locate:

mdfind Radius3