What's the equivalent of Linux's updatedb command for the Mac?

It's locate.updatedb on Mac.

sudo /usr/libexec/locate.updatedb

For more information see the locate.updatedb man page.


You can do sudo ln -s /usr/libexec/locate.updatedb /usr/local/bin/updatedb to make the updatedb command available.


Personally, I just installed findutils (use MacPorts or Homebrew).

Then you have GNU locate and updatedb.

updatedb won't work without sudo.

Personally I prefer to have a per user locatedb though; if you sudo other users will know the names/locations of all your files.

I have a cron job to run:

updatedb --localpaths='/Users/grogs' --output='/Users/grogs/tmp/locatedb'

And in my .zshrc .bashrc/.bashprofile:

export LOCATE_PATH="~/tmp/locatedb"