I ran locate blob.txt and I got:

$ locate .bashrc

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

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

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

I ran this command and my locate database was built within a few minutes (includes tens of thousand of files).

On my Linux (Ubuntu) system my locatedb database is updated automatically by default, on a daily basis I believe.

How do I turn this on for my Mac?

  • While this could work, did you consider using the spotlight feature to find a file : mdfind -name blob.txt? – Matthieu Riegler Feb 8 '14 at 14:04
  • Interesting option. I tend to stick to methods that will work pretty much the same in Ubuntu. Best of all are tricks like alt-tab that work in all 3 OS's, i.e. Winodws too. – Michael Durrant Feb 8 '14 at 16:01

When you run that command, launchd will update the database every week automatically. On my system, the plist is set to run every Saturday at 3:15am.

Edit from OP: Yes, works, note: Also it ran once when submitted, so for me, within a few minutes I was able to use locate. the update process runs in the background so you may have to wait a few minutes before locate then works (You'll get the "The locate database ... does not exist" message until then).

| improve this answer | |

com.apple.locate.plist is a launch daemon with a predefined schedule:


This means that it runs every Saturday (Weekday=6) at 3:15.

You can edit these values in the plist to modify the schedule to your liking. Removing the Weekday key will mean that it runs every day of the week, if you need it to run more often.

| improve this answer | |

You must log in to answer this question.

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