Locate command with regex equivalent in OSX

bashcommand lineterminal

I'm learning linux bash on my mac. Is there an equivalent to this command in OSX?

locate --regex 'bin/(bz|gz|zip)'

Best Answer

The macOS version of locate doesn’t have a regex option. You can use * and ? in the search pattern but that’s it.

Before you can use locate you will have to enable it (i. e. have the locate database built) using the following command—by default it is disabled:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist