Desert Crystal Solutions

Menu

Update Locate Database on Mac OSX

Monday, 01 October 2012 07:38

The locate command on OS X allows easy and fast searching of your Mac through the command line. It searches from a database, so it's super fast, 10x better than find.

I use it all the time, and because I constantly switch between Linux systems and my mac, I always get frustrated when the location database needs updating because I can never remember the command!  This is the default command to update the database:

sudo /usr/libexec/locate.updatedb

For some reason, I can never remember that, so to make our lives easier; we'll create a new easy-to-remember command for the update script, how about what it should be in the first place!:

sudo ln -s /usr/libexec/locate.updatedb /usr/bin/updatedb

Now you want to update your Mac's locate database? Just run the "universal" linux command updatedb!:

sudo updatedb &

It's just so easy..! 
I honestly don't know why I didn't do this sooner.  :)  Enjoy.