The file in question is:


What is wrong with locate?

  • 1
    Do you have the daemon /System/Library/LaunchDaemons/com.apple.locate.plist enabled ?
    – fd0
    May 24 '16 at 12:42

Nothing is wrong with locate. By default, it doesn't search for/in hidden files/directories.

The directories /.metadata and /.plugins are both hidden by the fact they are prefixed with a period "." which means that locate is not going to index the files within those directories.

I prefer to use the find command:

sudo find / -name connections.xml

  • 1
    Thank you. The find command works. Is there a way to default enable locate to search in hidden directory and for hidden files? I am used to linux and locate actually locating things. May 24 '16 at 15:11
  • I would have to do further research because once I found that it didn't search for hidden files way back when without some editing of the .plist file, I abandoned it and went with find insead. Besides, find is universal across OS X, FreeBSD, and Linux.
    – Allan
    May 24 '16 at 15:15

The locate database in built by the script /usr/libexec/locate.updatedb. The script is run by the user nobody in this line

tmpdb=`su -fm nobody -c "$0"` || rc=1

unless the user nobody has access to a directory then the content of that directory is not recorded in the database. A simple solution would be to use mdfind.

mdfind -name connections.xml
  • I tried mdfind connections.xml, it didn't return results. May 24 '16 at 15:10

You need to make sure the daemon is running on your machine:

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

Alternatively you can also run the following command and build the database:

sudo /usr/libexec/locate.updatedb

Note, that indexing of files from the filesystem would take a while, so locate will not show you all the files matched immediately.

Or you may use the regular find for search of what you need.

  • Thanks for the reply. If the daemon isn't running ios will tell you to build the locatedb with those commands when you call locate. I had already run them - I think the problem has to do with hidden directories. May 24 '16 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .