Compare two blocks of text on a Mac

Two config files that look identical usually differ by something invisible — a tab against four spaces, a trailing space, or a line ending from another operating system.

What people are usually comparing

Rarely prose. Almost always a config file against the one that works, an API response before and after a change, an environment file against its example, or a certificate against the one the server is actually serving. All four are things you would not upload to a comparison site if you thought about it for a moment.

Line diff and word diff

A line diff shows which lines changed, which is what you want for code and configuration. A word diff shows what changed inside a line, which is what you want when a long line differs by one token and the line diff simply marks the whole thing as changed.

Ignoring what does not matter

  • Ignore whitespace — for comparing files that passed through different editors or formatters.
  • Ignore case — for comparing hostnames, header names, hex digests and anything else where case is not significant.

The invisible causes

When two files look the same and diff says otherwise, the cause is nearly always one of a short list: a mix of tabs and spaces, trailing whitespace, CRLF line endings against LF, a missing newline at the end of the file, or a byte order mark. The String Inspector in Bellows shows the actual code points when you need to see exactly which.

How to check the claim rather than trust it

Bellows is signed without a network entitlement. That is not a policy someone wrote down — it is a permission the binary does not have, and macOS enforces it whether the app wants to connect or not. You can read the entitlements it was signed with:

codesign -d --entitlements - /Applications/Bellows.app

Neither com.apple.security.network.client nor com.apple.security.network.server appears in the output. Without them the sandbox refuses to open a socket.

Text Diff is one of 41 tools in Bellows

A native Mac app that ships with no network entitlement, so macOS blocks it from connecting at all. One-time purchase, every future update included.

What Bellows is →

Questions

How do I compare two files on a Mac?

Terminal has diff built in, and FileMerge ships with Xcode. For pasted text rather than files, Bellows compares two blocks side by side with whitespace and case handling.

Why does diff report changes I cannot see?

Almost always trailing whitespace, tabs against spaces, or CRLF line endings from Windows. Turning on ignore-whitespace confirms the cause quickly.

Related