I use a Mac running High Sierra. I am cleaning up my hard drive and I was looking for remnants of a program I deleted from my Mac. I used the locate command like this: locate Canopy
. I once had the Enthought Canopy package installed. When I run that command I get about 16 instances of Canopy. This is the first: /Applications/Enthought Canopy (64-bit)
. The other 15 lines are just extensions of this one. I have searched my Applications folder for a file "Enthought Canopy (64-bit)" but it does not exist. If I use the command line to try to cd "/Applications/Enthought Canopy (64-bit)"
it says "No such file or directory. Does anyone know why locate
is giving me false information?
From locate(1)
that is to say run man 1 locate
one may read
DESCRIPTION
The locate program searches a database for all pathnames which match the
specified pattern. The database is recomputed periodically (usually
weekly or daily),
which may well explain out-of-date results. A bit beyond that there is:
/System/Library/LaunchDaemons/com.apple.locate.plist Job that starts the
database rebuild
which indicates a weekly rebuild. (This is on a Mac OS X 10.11 release, so Apple may have fiddled with things since.)
More typical on macOS might be to use mdfind
or similar tools that tie into the Spotlight database; that database may be more frequently updated than the locate database is. (But I've disabled the Spotlight tools as they go nuts with I/O on my old spinny metal 2009 hard drive...)