Skip to main content
no longer applies to the latest brew
Source Link
Scott Prive
  • 888
  • 1
  • 11
  • 16

EDIT SEP 2023: See @Ambareesh's comment below this; my answer is now obsolete (as are many of the earlier answers).

If you still have an this problem, I would just reinstall brew from scratch using defaults (or there may be an easier way).


brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

EDIT SEP 2023: See @Ambareesh's comment below this; my answer is now obsolete (as are many of the earlier answers).

If you still have an this problem, I would just reinstall brew from scratch using defaults (or there may be an easier way).


brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

typo then OCD rephrase
Source Link
Scott Prive
  • 888
  • 1
  • 11
  • 16

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

This shows MacOS provided find, which defaults in the system $PATH:

$ which find
/usr/bin/find

This installs GNU find:

$ brew install findutils

While it has been installed, it does not touch the mac version, nor will it assume the default in your path. This is to prevent surprises. You could stop here and do no additional configuration, but to target the GNU version your scripts would need to specify the full path to the executable.

Now, make itGNU default (first in path), so sinplemeaning just a plain find means the GNU version. Add thiscommand invokes it, you will need to put the start of your $PATH variable --GNU find's directory "first" in your path. In my case it'smanage $PATH in $HOME/.bash_profile but on some systems that could be $HOME/.bashrc or other file.

PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH

^^ You might have other things already "ahead" of your default PATH var. You can either add this verbatim as a new line, or carefully insert the string (including the $ and using the : to separate from the next value)

In every shell window open, reload your env (do NOT reboot):

$ source ~/.bash_profile

Or, close all your terminal windows. New terminal windows will have the updated PATH var. DO NOT reboot.

Now check your findfind:

$ which find
/usr/local/opt/findutils/libexec/gnubin/find

Hooray, GNU is the default find. But we did not harm the OS default find -- it is still there, so any macOS-specific scripts will still find it:

$ ls /usr/bin/find
/usr/bin/find

If you come across any non-Apple, macOS scripts that heavily assumed "find" is of the BSD type (Apple's version), but you installed GNU find first in your search path, then you will run into a compatibility problem with Brew. Because BSD 'find' has options that GNU 'find' does not, and vice-versa. Few scripts assume you use BSD find, but if you encounter this: Just add a line to the top of that script to alias find to the correct one, or you can manipulate $PATH so that find goes to the correct installed instance of the command, or if none of this sounds easy you can edit the script so that all instances of find command include the fully-qualified-path to the correct version. But need for this paragraph is rare. :-)

Be aware that --with-default-names functionality is removed (yet, confusingly, the brew website still suggests this option). With any modern Brew install, trying to use --with-default-names will just give you an error message. Things change, and unfortunately the Brew website is always seriously outdated for reasons not made clear,

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

This shows MacOS provided find, which defaults in the system $PATH:

$ which find
/usr/bin/find

This installs GNU find:

$ brew install findutils

While it has been installed, it does not touch the mac version, nor will it assume the default in your path. This is to prevent surprises.

Now, make it default, so sinple find means the GNU version. Add this to the start of your $PATH variable -- in my case it's in $HOME/.bash_profile but on some systems that could be .bashrc or other file.

PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH

^^ You might have other things already "ahead" of your default PATH var. You can either add this verbatim as a new line, or carefully insert the string (including the $ and using the : to separate from the next value)

In every shell window open, reload your env (do NOT reboot):

$ source ~/.bash_profile

Now check your find:

$ which find
/usr/local/opt/findutils/libexec/gnubin/find

Hooray, GNU is the default find. But we did not harm the OS default find -- it is still there, so any macOS-specific scripts will still find it:

$ ls /usr/bin/find
/usr/bin/find

If you come across any non-Apple, macOS scripts that heavily assumed "find" is of the BSD type (Apple's version), but you installed GNU find first in your search path, then you will run into a compatibility problem with Brew. Because BSD 'find' has options that GNU 'find' does not, and vice-versa. Few scripts assume you use BSD find, but if you encounter this: Just add a line to the top of that script to alias find to the correct one, or you can manipulate $PATH so that find goes to the correct installed instance of the command, or if none of this sounds easy you can edit the script so that all instances of find command include the fully-qualified-path to the correct version. But need for this paragraph is rare. :-)

Be aware that --with-default-names functionality is removed (yet, confusingly, the brew website still suggests this option). With any modern Brew install, trying to use --with-default-names will just give you an error message. Things change, and unfortunately the Brew website is always seriously outdated for reasons not made clear,

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

This shows MacOS provided find, which defaults in the system $PATH:

$ which find
/usr/bin/find

This installs GNU find:

$ brew install findutils

While it has been installed, it does not touch the mac version, nor will it assume the default in your path. This is to prevent surprises. You could stop here and do no additional configuration, but to target the GNU version your scripts would need to specify the full path to the executable.

Now, make GNU default (first in path), meaning just a plain find command invokes it, you will need to put the GNU find's directory "first" in your path. In my case manage $PATH in $HOME/.bash_profile but on some systems that could be $HOME/.bashrc.

PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH

^^ You might have other things already "ahead" of your default PATH var. You can either add this verbatim as a new line, or carefully insert the string (including the $ and using the : to separate from the next value)

In every shell window open, reload your env:

$ source ~/.bash_profile

Or, close all your terminal windows. New terminal windows will have the updated PATH var. DO NOT reboot.

Now check your find:

$ which find
/usr/local/opt/findutils/libexec/gnubin/find

Hooray, GNU is the default find. But we did not harm the OS default find -- it is still there, so any macOS-specific scripts will still find it:

$ ls /usr/bin/find
/usr/bin/find

If you come across any non-Apple, macOS scripts that heavily assumed "find" is of the BSD type (Apple's version), but you installed GNU find first in your search path, then you will run into a compatibility problem with Brew. Because BSD 'find' has options that GNU 'find' does not, and vice-versa. Few scripts assume you use BSD find, but if you encounter this: Just add a line to the top of that script to alias find to the correct one, or you can manipulate $PATH so that find goes to the correct installed instance of the command, or if none of this sounds easy you can edit the script so that all instances of find command include the fully-qualified-path to the correct version. But need for this paragraph is rare. :-)

Be aware that --with-default-names functionality is removed (yet, confusingly, the brew website still suggests this option). With any modern Brew install, trying to use --with-default-names will just give you an error message. Things change, and unfortunately the Brew website is always seriously outdated for reasons not made clear,

clearer phrasing
Source Link
Scott Prive
  • 888
  • 1
  • 11
  • 16

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

This shows MacOS provided find, which defaults in the system $PATH:

$ which find
/usr/bin/find

This installs GNU find:

$ brew install findutils

While it has been installed, it does not touch the mac version, nor will it assume the default in your path. This is to prevent surprises.

Now, make it default, so sinple find means the GNU version. Add this to the start of your $PATH variable -- in my case it's in $HOME/.bash_profile but on some systems that could be .bashrc or other file.

PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH

^^ You might have other things already "ahead" of your default PATH var. You can either add this verbatim as a new line, or carefully insert the string (including the $ and using the : to separate from the next value)

In every shell window open, reload your env (do NOT reboot):

$ source ~/.bash_profile

Now check your find:

$ which find
/usr/local/opt/findutils/libexec/gnubin/find

Hooray, GNU is the default find. But we did not harm the OS default find -- it is still there, so any macOS-specific scripts will still find it:

$ ls /usr/bin/find
/usr/bin/find

If you come across any thirdnon-party MacApple, macOS scripts that heavily assumed use"find" is of the macOSBSD type (Apple's version), but you installed GNU find first in your search path, then you can either alterwill run into a compatibility problem with Brew. Because BSD 'find' has options that script'sGNU 'find' does not, and vice-versa. Few scripts assume you use BSD find, but if you encounter this: Just add a line to the top of that script to alias find to the correct one, or you can manipulate $PATH valueso that find goes to the correct installed instance of the command, or if none of this sounds easy you could always search-and-replace theircan edit the script so that all instances of find command and giveinclude the fully-qualified path-path to the find command you requirecorrect version. But need for this paragraph is rare. :-)

Be aware thatBe aware that --with-default-names functionality is removed (yet, confusingly, the brew website still suggests this option). With any modern Brew install, trying to use --with-default-names functionality is removedwill just give you an error message. Things change, howeverand unfortunately the brew website still offers this option (it won't work on any recent install). TheirBrew website appears to lag the Github repois always seriously outdated for some reason.reasons not made clear,

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

This shows MacOS provided find, which defaults in the system $PATH:

$ which find
/usr/bin/find

This installs GNU find:

$ brew install findutils

While it has been installed, it does not touch the mac version, nor will it assume the default in your path. This is to prevent surprises.

Now, make it default, so sinple find means the GNU version. Add this to the start of your $PATH variable -- in my case it's in $HOME/.bash_profile but on some systems that could be .bashrc or other file.

PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH

^^ You might have other things already "ahead" of your default PATH var. You can either add this verbatim as a new line, or carefully insert the string (including the $ and using the : to separate from the next value)

In every shell window open, reload your env (do NOT reboot):

$ source ~/.bash_profile

Now check your find:

$ which find
/usr/local/opt/findutils/libexec/gnubin/find

Hooray, GNU is the default find. But we did not harm the OS default find -- it is still there, so any macOS-specific scripts will still find it:

$ ls /usr/bin/find
/usr/bin/find

If you come across any third-party Mac scripts that heavily assumed use of the macOS find, you can either alter that script's $PATH value, or you could always search-and-replace their find command and give the fully-qualified path to the find command you require.

Be aware that --with-default-names functionality is removed, however the brew website still offers this option (it won't work on any recent install). Their website appears to lag the Github repo for some reason.

brew has changed since this question was posted. The accepted answer was not correct before - not enough for someone to follow anyways (rebooting wasn't the answer) - but now the packaging of brew and pathing has also changed. To keep this page relevant, here is the new answer.

This shows MacOS provided find, which defaults in the system $PATH:

$ which find
/usr/bin/find

This installs GNU find:

$ brew install findutils

While it has been installed, it does not touch the mac version, nor will it assume the default in your path. This is to prevent surprises.

Now, make it default, so sinple find means the GNU version. Add this to the start of your $PATH variable -- in my case it's in $HOME/.bash_profile but on some systems that could be .bashrc or other file.

PATH=$(brew --prefix)/opt/findutils/libexec/gnubin:$PATH

^^ You might have other things already "ahead" of your default PATH var. You can either add this verbatim as a new line, or carefully insert the string (including the $ and using the : to separate from the next value)

In every shell window open, reload your env (do NOT reboot):

$ source ~/.bash_profile

Now check your find:

$ which find
/usr/local/opt/findutils/libexec/gnubin/find

Hooray, GNU is the default find. But we did not harm the OS default find -- it is still there, so any macOS-specific scripts will still find it:

$ ls /usr/bin/find
/usr/bin/find

If you come across any non-Apple, macOS scripts that heavily assumed "find" is of the BSD type (Apple's version), but you installed GNU find first in your search path, then you will run into a compatibility problem with Brew. Because BSD 'find' has options that GNU 'find' does not, and vice-versa. Few scripts assume you use BSD find, but if you encounter this: Just add a line to the top of that script to alias find to the correct one, or you can manipulate $PATH so that find goes to the correct installed instance of the command, or if none of this sounds easy you can edit the script so that all instances of find command include the fully-qualified-path to the correct version. But need for this paragraph is rare. :-)

Be aware that --with-default-names functionality is removed (yet, confusingly, the brew website still suggests this option). With any modern Brew install, trying to use --with-default-names will just give you an error message. Things change, and unfortunately the Brew website is always seriously outdated for reasons not made clear,

Source Link
Scott Prive
  • 888
  • 1
  • 11
  • 16
Loading