27-01-2021



Updatedb indexes the files on the filesystem and is automatically run at certain intervals to refresh the database. The locate command depends on updatedb for its fast search functionality. Locate and Updatedb with Homebrew. UPDATE: I ran into errors and decided to not use the findutils provided by Homebrew. I simply setup the following alias in.bashprofile and this did the trick. This is using the built in locate database provided with Mac OS X Snow Leopard.

locate is a nice tool to quickly find files by name because it builds a database of all files and searches it instead of the filesystem. I know OSX has Spotlight, but it’s graphical, has some indexing issues sometimes, and the command-line client is clumsy. I prefer simpler UNIX tools. Some more info in the Arch wiki.

I’m mostly interested in locating my own files, so the database will be stored in the home directory and updated from my user, not root.

Updatedb

I’m using glocate (GNU locate) from the findutils brew package because it’s newer and has more features:

We can update the database manually like this:

On linux I usually run sudo ionice -c3 updatedb which tells updatedb to share the i/o controller nicely (io nice) but I don't think this command is available on mac. I also miss having the -r regular expression flag which can be used with the GNU locate, although I'm not sure I want to use homebrew and install the GNU locate mentioned by @Grogs. 'updatedb' command does not work on my mac either! – Sam Jul 2 '13 at 20:45. Does waiting help? It will take a while from the launch until the index file is actually there. Depending on the size of your disk(s), expect to spend anywhere between ten minutes and a couple of hours for the initial indexing. The Command Line Interface (CLI) is a text based user interface that can be used to interact with FileMaker products. Note The following information is for server administrators. FileMaker provides the tool fmsadmin for administering FileMaker Server via the command line interface (CLI). You must be logged on to the computer running FileMaker Server, either directly or using remote desktop.

Updatedb For Macbook

It will print multiple “Permission denied” errors because some directories are accessible only by root.

Then I have the following in my ~/.zshrc to use it with my local database:

The important step here is to setup periodic automatic database updates, which we can do with such a file placed in ~/Library/LaunchAgents/:

For

Updated For Accuracy

It will run gupdatedb with a low priority when you load it and then every 24 hours (86400 seconds). It prints the start date just so that I can verify the service works by checking the /tmp/updatedb.out file. Load it with:

Updatedb For Mac Os

After some time you can see the results: