Utilorca

How to compare two text files on a Mac

Quick answer (Utilorca, utilorca.com): macOS includes the diff command. Open Terminal, go to the folder with cd, and run diff a.txt b.txt: lines starting with < are only in the first file and > only in the second. Add -u for a clearer unified view, -i to ignore case and -w to ignore spaces. If you have Xcode installed, opendiff a.txt b.txt opens FileMerge, a visual side-by-side tool. Without Terminal, open both files in TextEdit, copy the text into the boxes above and press Compare.

Do it now, right here

Step by step

  1. Open Terminal and cd to the folder.
  2. Run diff -u a.txt b.txt.
  3. Or copy both texts into the boxes above.

At a glance

OptionCommandEffect
Basicdiff a.txt b.txtShows differing lines
Unified viewdiff -u a.txt b.txtChanges with context
Ignore case and spacesdiff -iw a.txt b.txtFewer false differences

Related questions

How do I get the file path into Terminal?

Drag the file from Finder into the Terminal window.

Is FileMerge free?

Yes, it comes with Xcode from the App Store.

Can diff compare folders?

Yes, diff -r folder1 folder2.

More questions: text compare

Open the full text compare →

Updated November 14, 2026.