Skip to content

Instantly share code, notes, and snippets.

@g-k
Created April 17, 2013 02:26
Show Gist options
  • Save g-k/5401331 to your computer and use it in GitHub Desktop.
Save g-k/5401331 to your computer and use it in GitHub Desktop.
mdfind util for osx notes

Recently an mdworker process was pegging my CPU and cooking my lap.

From its man page description: "mdworker is the metadata server worker process. It is used by mds to scan and index files as a volume is mounted or a file changes."

What's mds? "mds is the metadata server. It serves all clients of the metadata APIs, including Spotlight."

mdfind uses the builtin metadata index and can be a faster alternative to recursive grep or find and an easy way to search all the files on a mac (assuming the index is up to date):

$ find . -name '*.js'
$ mdfind -onlyin . -name .js

$ grep -Rl window *
$ mdfind -onlyin . window

Some Links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment