0

macOS 10.15 comes with a very old version of the diff command. I've read in https://unix.stackexchange.com/a/338960/80391 that version 3.4 contains the --color argument.

How can I update the version on macOS so that I can use this newer feature?

  • 1
    You'll have build it from source and add it to your environment. You can get the source code here: http://ftp.gnu.org/gnu/diffutils/ – Nasir Riley Jun 06 '20 at 21:51

1 Answers1

5

Since macOS does not include a package manager, you have to install one if you want newer versions of the tools that come with the OS. The most popular one these days is Homebrew. Macports is a similar project.

After installing Homebrew, you can install a newer version of diff by installing the diffutils package:

brew install diffutils

Of course you can also build everything from source, but using a package manager is easier.

philb
  • 228