Install Locate on MacOS with Homebrew

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to install linux commands find, updatedb, locate and xargs on MacOS using Homebrew. Tested on macOS Sierra.


Prerequisites


Install Findutils

brew update
brew upgrade
brew install findutils


Use Instead of System Binaries

By default the commands can be accessed by prefacing the commands (find, updatedb, locate and xargs) with a g. Such as, gupdatedb. However you can add the path to the replacement binaries to your .bashrc, .bash_profile or whichever you have loading.

# HomeBrew Findutils
PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add the "gnuman" directory to your MANPATH from your bashrc as well:

MANPATH="/usr/local/opt/findutils/libexec/gnuman:$MANPATH"

Related Articles