Unofficial archive. This is a read-only, community-run archive of the Apple Support Community. It is not affiliated with or endorsed by Apple Inc.

How to compare two files on macOS?

MacOS Tahoe (26.7). A simple question: is there, on MacOS, a utility that allows to tell if there are differences between the contents of two files?


[Re-Titled by Moderator]

Original Title: Differences between two files?

14 replies

to add— you can keep it simple:


Terminal commands to compare folders  / and compare file content:

you can drag and drop the files directly onto the Terminal window for the complete path to your folder/files


ex.

diff -rq folder1 folder2


 The -r is recursive and the -q is brief. So it will provide a list of filenames which are different.

diff -r --brief --exclude=.git /path/to/folder1 /path/to/folder2


ex.

files can be compared:

diff (file input 1) (file input 2)



All differences are listed in the output...

if you are returned to the prompt with no difference list...they are exactly the same.


(a little more cumbersome to use the -y flag for side by side comparison)

You can use Terminal and the diff command.


Type

man diff 

in Terminal to pull up the syntax


diff -y


gives a side-by-side comparison.


Anything other than text files might be problematic, but it depends what you're looking for.

In the Terminal, you can do:

man diff


to ascertain file comparisons.


If you have Xcode installed, you can also use the visual opendiff utility from the Terminal:

opendiff textfile1 textfile2


I have used VisualDiffer for many years and it's my preferred file/folder comparison tool.


It used to be a paid app via the AppStore but for reasons I'm not privy to the developer removed it and it became an opensource project. You can find on on GitHub. (Note, I have not used the opensource version myself, so I am not able to compare it to the older, paid version.)

Hi, here the VisualDiffer author. The open version is the successor to the one that used to be on the store; over the years, dozens of bugs have been fixed and features added. This means the open version is superior in every respect and, above all, I actively maintain it, with the latest release coming out just today.

FWIW, the paid version I have (Visual Differ 1.8.10) works perfectly fine on Monterey. I've had no problems with it.


In my earlier post I meant that I'd try the opensource version once I move to Sequoia. Your wiki page says "MacOS 13+" ... which I would interpret to mean that it would work on Ventura, Sonoma, Sequoia, etc. Is that not the case?

DenisMaillard wrote:
MacOS Tahoe (26.7). A simple question: is there, on MacOS, a utility that allows to tell if there are differences between the contents of two files?
[Re-Titled by Moderator]
Original Title: Differences between two files?


ref:

https://nektony.com/how-to/compare-files-on-mac

etresoft wrote:
The OP has a simple question. Ain't none of this simple.
In hindsight, I think my answer could have been 25% simpler. So that's on me.


Ha haha — thanks. I always appreciate your post.

davide.osx wrote:
Hi, here the VisualDiffer author. The open version is the successor to the one that used to be on the store; over the years, dozens of bugs have been fixed and features added. This means the open version is superior in every respect and, above all, I actively maintain it, with the latest release coming out just today.

That is good to know. I'm still using the paid version on Monterey but would like to move to Sequoia. I'll give it a try. Thanks for the info.

Thanks for the tips. I'll have a look at them.

DenisMaillard wrote:
A simple question: is there, on MacOS, a utility that allows to tell if there are differences between the contents of two files?

Yes.

leroydouglas wrote:
to add— you can keep it simple:

The OP has a simple question. Ain't none of this simple.


In hindsight, I think my answer could have been 25% simpler. So that's on me.

Re all: Thanks for all the replies. They were helpful.

DenisMaillard.

I’m sorry about this, but I had to raise the compatibility requirement to Ventura 13.5.

I’m currently working on Sequoia—it’s fast and reliable.

End of off-topic digression ;)