DEV Community

Martin Grüner
Martin Grüner

Posted on Originally published at martingruner.com AI-assisted

How to compare two folders on a Mac (Terminal, Git, and a visual diff)

You have two copies of a project, a backup and the original, or two versions of a delivery, and you need to know what is different between them. Finder cannot tell you. Here are three ways to do it on a Mac, from the quickest to the most thorough.

1. Terminal: diff -rq

macOS ships with diff, and it can compare whole folder trees:

diff -rq "Folder A" "Folder B"
Enter fullscreen mode Exit fullscreen mode

-r walks every subfolder and -q only reports which files differ instead of printing every changed line. The output lists files that differ and files that exist on only one side:

Files Folder A/config.json and Folder B/config.json differ
Only in Folder B/assets: logo@2x.png
Enter fullscreen mode Exit fullscreen mode

This is fast and always available. It tells you which files differ, not what changed inside them, and a file that was moved shows up twice: once as missing and once as new.

2. Git: git diff --no-index

If you want to see the changed lines too, Git can compare two folders that are not in a repository:

git diff --no-index "Folder A" "Folder B"
Enter fullscreen mode Exit fullscreen mode

You get a normal patch for every changed text file, with colors and your usual pager. Add --stat for a summary of changed files first. It works well for source code. It is harder to read for spreadsheets, PDFs, Word documents, and images, which show up as binary files.

3. A visual folder comparison

When the folders are large, mix file types, or you need to be sure nothing is missing, a visual comparison is easier to review. I build Diff Anything, a comparison app for Mac and Windows, so this is the workflow I use:

  1. Choose the original folder on the left and the copy or newer version on the right.
  2. Check the folder options: include subfolders, decide whether hidden files such as .env belong in the review, and add ignore patterns for build output like DerivedData or node_modules.
  3. Read the results in a tree or a table. Each path is marked as only on the left, only on the right, changed, moved, or identical, and you can search and filter by status.
  4. Open any changed pair to see what is different inside it: text and code as a side-by-side diff, spreadsheets cell by cell, PDF and Word documents by their text, and images with an overlay.

Two settings matter when you need an exact answer. Turn on Compare hashes for a byte-level content check rather than trusting names, sizes, and dates. Leave Semantic structured files on when you are reviewing configuration: JSON, YAML, XML, CSV, and environment files are then compared by their parsed content, so reordered JSON keys do not show up as a change.

Moved files are matched by content at a different path, so a renamed asset appears once as a move instead of a deletion plus an addition.

Everything runs on your Mac. There is no account, no upload, and no AI involved, which matters when the folders hold client work, credentials, or anything you would rather not paste into a website. It needs macOS 13 or later, and there is a free version to try it on a small pair of folders.

Which one to use

  • Quick check of which files differ: diff -rq.
  • Code changes you want to read as a patch: git diff --no-index.
  • Backups, client handoffs, mixed file types, or moved files: a visual comparison.

The full guide, with a two-minute video and a table explaining every result label, is here: Compare two folders on Mac and see what changed. If you are on Windows, there is a Windows version of the guide too.

Top comments (0)