CLI diff tool macOSWindows

Run exact local comparisons from the command line

Use Diff Anything from the CLI with explicit modes, terminal or machine output, Git difftool integration, difference exit codes, and Pro batch reports.

Direct answer

Which command-line features does Diff Anything support?

Diff Anything uses its desktop executable with --cli and exactly two source paths. Single comparisons support auto, text, json, yaml, xml, csv, env, http, api, folder, archive, document, and binary modes; summary, terminal, or JSON output; colour, language, and context controls; and an opt-in difference exit code. Pro batch manifests support YAML or JSON input and summary, JSON, JUnit, or SARIF output.

Accuracy note: reviewed against Diff Anything 1.2 on .

Diff Anything three-way merge workspace with Base, Ours, Theirs, and an unresolved conflict
Review automatic line merges and resolve overlapping edits with Base, Ours, and Theirs visible together.

Single comparisons

Every single-comparison option, without implied flags.

Use --mode auto|text|json|yaml|xml|csv|env|http|api|folder|archive|document|binary and --format summary|terminal|json. A terminal defaults to terminal output; redirected stdout defaults to summary.

Use --color auto|always|never, --language LANGUAGE, and --context LINES. Passing --language auto clears the override; context must be non-negative and defaults to three lines.

  • --exit-code: 0 clean, 1 different, 2 invalid input or comparison failure
  • Without --exit-code, a valid changed single comparison exits 0
  • Use -- before paths when a filename begins with a dash
  • --help, --version, and --integration-help are available

Batch and CI

Batch behavior is explicit and Pro-only.

A batch manifest can be YAML or JSON. Its root can be an object with a comparisons array or a top-level array. Each item accepts name, left, right, and an optional supported mode.

Batch output formats are summary, JSON, JUnit, and SARIF. Output goes to stdout. Batch returns 0 only when every comparison is clean, 1 when any case changed or failed, and 2 when invocation or manifest loading fails.

  • JUnit records differences as test failures and execution errors as errors
  • SARIF 2.1.0 records changes as warnings and failed cases as errors
  • Desktop profiles and expected-result fields are not batch-manifest options

Free and Pro

Desktop previews and CLI modes have different Free boundaries.

Free desktop use can preview every comparison engine for files up to 5 MiB per side and 10 new comparison sessions per local day; collections show the first 100 items and PDFs show the first 3 page previews. The free CLI supports text and JSON only.

The one-time Pro purchase unlocks every other CLI mode, every batch manifest, larger sources within technical limits, report export, profiles and history, three-way merge, folder synchronization, and trusted preprocessors.

Best for

Where this workflow fits.

  • Reading syntax-highlighted file differences in a terminal
  • Using Diff Anything as a Git difftool
  • Running repeatable comparison manifests in CI

No accounts, cloud comparison service, analytics, or telemetry.

Relevant capabilities

What Diff Anything brings to the job.

Practical workflow

From setup to a reviewed result.

  1. Enter CLI mode

    Run the installed desktop executable with --cli, any options, and exactly two readable source paths.

  2. Choose mode and output

    Use automatic detection or an explicit supported mode, then select terminal, summary, or JSON output for a person or another program.

  3. Set process behavior

    Add --exit-code only when a changed single comparison should return 1; invalid input and comparison errors return 2.

  4. Integrate safely

    Configure Git without --exit-code, or use a Pro batch manifest for summary, JSON, JUnit, or SARIF CI output.

Useful in practice

Related searches

One workflow, several common names.

This page focuses on CLI diff tool. People also describe the same or closely related job as command line diff tool, Git difftool, JSON diff CLI, CI file comparison.

command line diff toolGit difftoolJSON diff CLICI file comparison

Direct answers

Questions about CLI diff tool.

Which command-line features does Diff Anything support?

Diff Anything uses its desktop executable with --cli and exactly two source paths. Single comparisons support auto, text, json, yaml, xml, csv, env, http, api, folder, archive, document, and binary modes; summary, terminal, or JSON output; colour, language, and context controls; and an opt-in difference exit code. Pro batch manifests support YAML or JSON input and summary, JSON, JUnit, or SARIF output.

Does Diff Anything have a separate image CLI mode?

No. The documented CLI mode list has no image mode. Image files can still be inspected through supported automatic or binary handling, while the purpose-built visual image workspace is a desktop feature.

Should a Git difftool command use --exit-code?

No. Git already invokes a difftool for a changed pair and expects successful processing, so the documented difftool command omits --exit-code.

Where is the executable installed?

Microsoft Store builds declare the diff-anything.exe execution alias. The macOS app does not add itself to PATH; invoke /Applications/Diff Anything.app/Contents/MacOS/diff-anything or maintain your own PATH entry.

Go deeper

Run repeatable comparisons, read highlighted terminal output, interpret exit codes, integrate with Git, and publish machine-readable CI results.

Read Use Diff Anything from the CLI, Git, and CI
More Diff Anything

Browse every focused tool and workflow.

See all Diff Anything tools