|
Enabling the locate Command in Mac OS X |
|
|
|
If you trying to use the locate command within terminal but you get an error it is because when you first install OS X, it won't have all the UNIX commands available. Specifically, “whatis," “man -k," and “locate," all of which are useful for beginners (like me!) will not be there.
Respectively, "whatis" provides a one-line description of a command, "man -k [keyword]" finds all instances of [keyword] in the manual pages, and "locate [fname]" shows you where [fname] is in the directory structure. A cron (UNIX scheduler program) task needs to be run to create these databases. Unfortunately, it won't run until the end of the first week, assuming you leave your machine on the whole time. You can force an immediate update, though, by running the following command in Terminal: sudo /usr/libexec/locate.updatedb
You should now be able to use locate!
|