Diffutils --with-default-names


#1

I tried to install the diffutils package expecting to get a new command named gdiff instead of diff but I did not find the relevant option, or do not know if the option is indeed available. Is it?


(Claudia) #2

I tried to install the diffutils package expecting to get a new command named gdiff instead of diff but I did not find the relevant option, or do not know if the option is indeed available. Is it?

The diffutils package doesn’t offer any such option.

I agree with you in that installing the command as gdiff by default instead of diff would make for a more consistent UX and would be more in line with other formulae that install GNU utils, such as coreutils, findutils, gawk, gcal, gnu-sed, gnu-tar, and grep.

With that being said, GNU diff appears to be largely compatible with the /usr/bin/diff command built into macOS. There’s no evidence that GNU diff shadowing BSD diff break anyone’s workflow as of today.

Adding and maintaining an option for the diffutils formula would therefore have little advantage other than the UX aspect, and is probably not worth the effort. (See also the gpatch formula, where we have a similar situation.)


#3

@claui 1.0E99 thanks for the post. That’s very reassuring info. I’ll shadow the BSD diff.

Perhaps one easy mod for the diffutils formula would be to have it explicitly announce/explain/… that there is no g-prefixed option.


#4

@claui I installed diffutils as announced. Surprise: brew info claims this is v3.6 but diff --version says it is v2.8.1. This is bad news for me since I installed gnudiff for the --color option that needs v3.4 or later :frowning:


(Claudia) #5

@phs Try this:

$ /usr/local/bin/diff --version

If that returns v3.6 while diff --version still gives you v2.8.1, you need to update your PATH environment variable.

Run brew doctor; it will detect the misconfiguration and tell you how to fix it.