I ran

sudo /usr/libexec/locate.updatedb


locate Radium3

but it returns nothing!


$ ls ~/Library/Containers/com.catpigstudios.Radium3/
Container.plist Data

So why doesn't locate see all the files?

Am I using this command correctly on OS X?



sudo /usr/libexec/locate.updatedb

And look config:

/etc/locate.rc the configuration file


Post here output:



cat /etc/locate.rc


echo $0



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


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

mdfind -name text
  • I uncommented #SEARCHPATHS="/" in config, it didn't help. -v option doesn't seem to produce any additional output :/
    – davidhq
    Apr 6 '14 at 18:06
  • Give additional info for me plz. In answer "Edited" section. Apr 6 '14 at 18:28
  • pastie.org/8998774
    – davidhq
    Apr 6 '14 at 18:48
  • 1
    $ ls -la /var/db/locate.database -r--r--r-- 1 nobody wheel 19463861 Apr 6 20:08 /var/db/locate.database $ locate david.jpg /Users/david/temp/david.jpg
    – davidhq
    Apr 6 '14 at 19:51
  • 1
    you should update your answer to mdfind -name text which is more accurate. Just mdfind text gives you files that contain text as well.
    – davidhq
    Apr 6 '14 at 21:38

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.

  • Thank you! but now that I know about mdutil does it make sense to check out this? One use case I can think of is that I can trigger rescan manually with gupdatedb - with Spotlight not so easy or it would take longer (it also indexes files contents). Are there other advantages?
    – davidhq
    Apr 6 '14 at 22:22
  • 1
    Reindexing with mdutil/spotlight can take awhile for sure. updatedb is quicker for that. glocate seems to have no problem indexing system files, while I find mdfind ignores ~/Library and other system files. I definitely find I get more hits with glocate over mdfind in most circumstances. YMMV. Apr 7 '14 at 1:26
  • ok, I'm testing this now. I think I found some problem... fist I ran sudo gupdatedb, then saved glocate Radium output. Then I ran gupdatedb and it said: /.Trashes: Permission denied, the same for some other folders. I compared the output for both and it was the same! Strange...
    – davidhq
    Apr 7 '14 at 12:03
  • From what you're saying, you first ran sudo gupdatedb (running it as root), then you followed up later by running gupdatedb as a normal user which would not have access to the files that the root user would have access to, meaning you'd get permission denied errors. If you want a complete database of filenames for your whole system, keep running it as root. This does expose your files to other users on the system who may use the glocate command. But if you are the only user, that should be fine. Apr 11 '14 at 15:51

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

You must log in to answer this question.

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