FileMerge on Mac: How to Open It and Compare Files and Folders
FileMerge is the free diff and merge tool hidden inside Xcode. Here is how to open it, compare files and folders with opendiff, fix the common Xcode error, and what to use when it is the wrong tool.
Quick Answer
FileMerge is Apple's free visual diff and merge tool for macOS, and it ships inside Xcode rather than as its own app. Install Xcode, then open it from Xcode > Open Developer Tool > FileMerge or run opendiff fileA fileB in Terminal. The same command accepts two folders: opendiff folderA folderB.
FileMerge has been part of Apple's developer tools for years and still does one job well: showing two versions of a text file side by side and letting you pick which changes to keep. It is less well suited to checking a backup or a folder of photos, which is covered further down.
How to Open FileMerge
There is no FileMerge icon in the Applications folder, which is why most people cannot find it. The app lives inside the Xcode bundle:
/Applications/Xcode.app/Contents/Applications/FileMerge.appThree ways to launch it:
- From Xcode: open Xcode, then choose Xcode > Open Developer Tool > FileMerge from the menu bar.
- From Spotlight: press Cmd + Space, type
FileMerge, and press Return. Once it is running, right-click its Dock icon and choose Options > Keep in Dock so you never have to hunt for it again. - From Terminal: run
opendiffwith the two things you want to compare (next section), or open the app directly:
open -a FileMergeIf none of these work, Xcode is not installed. Get it free from the Mac App Store; it is a multi-gigabyte download, and you need to open it once and accept the license before the developer tools work.
Compare Two Files
In the FileMerge window, drag one file onto the Left field and the other onto the Right field, then click Compare. From Terminal it is one line:
opendiff old/config.yml new/config.ymlEach difference is numbered and joined across the two panes. Select a difference and use the Actions menu at the bottom right to choose the left version, the right version, both, or neither. The lower pane shows the merged result, which you save with File > Save Merge.
For a three-way merge, pass the common ancestor and an output path. These two options come straight from the opendiff manual page:
opendiff mine.txt theirs.txt -ancestor base.txt -merge merged.txtOnly need a yes-or-no answer on whether two files are identical? Dropping both into the free Compare Files tool compares their SHA-256 hashes, which works for any file type, not just text.
Compare Two Folders
FileMerge accepts directories in the same Left and Right fields, and opendiff accepts them on the command line:
opendiff ~/Documents/project ~/Backup/projectQuote any path that contains spaces:
opendiff "/Users/you/Desktop/Site v1" "/Users/you/Desktop/Site v2"The folder view walks both trees and lists what it found: files that exist on only one side and files whose contents differ. Opening a changed text file drops you into the normal side-by-side diff, so you can review and merge it without leaving the window. That makes FileMerge a good fit for two copies of a code project, a website, or a folder of configuration files.
FileMerge is a merge tool, not a read-only viewer
Its purpose is to produce merged files, and saving a merge writes to disk. If you are only checking that a backup matches the original, be careful where you save, or use one of the read-only methods below.
Fix “tool 'opendiff' requires Xcode”
The most common FileMerge problem is this message in Terminal:
xcode-select: error: tool 'opendiff' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instanceIt means the Mac has the Command Line Tools package (installed by xcode-select --install or by Homebrew) but the active developer directory does not point at a full Xcode. The opendiff command is only a launcher; FileMerge itself exists only inside Xcode.
- Install Xcode from the Mac App Store if it is not already in Applications.
- Open Xcode once and let it finish installing its components.
- Point the developer directory at Xcode:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
# Confirm
xcode-select -pxcode-select -p should now print /Applications/Xcode.app/Contents/Developer, and opendiff will launch FileMerge.
Use FileMerge with Git
Git knows about opendiff already, so there is nothing to script. Use it for one command with -t, or set it as the default:
# One-off
git difftool -t opendiff
git mergetool -t opendiff
# Make it the default
git config --global diff.tool opendiff
git config --global merge.tool opendiff
# Review a whole commit range as two folders
git difftool --dir-diff main featuregit difftool asks before opening each file; add -y to skip the prompt. With --dir-diff, git checks both versions out to temporary folders and hands them to FileMerge as a single folder comparison.
Where FileMerge Falls Short
FileMerge is a developer tool, and it shows when you use it for anything else:
- It needs Xcode. Installing a multi-gigabyte IDE to compare two folders once is a lot, especially on a small internal drive or a Mac you do not administer.
- It is a text diff. It is designed around lines of text. For photos, video, PDFs, archives, and Office documents there is no meaningful line diff to show, so the useful question becomes “are these two files byte-for-byte the same?”, which a checksum answers better.
- The result is a merged file, not a report. You can save a merge, but there is nothing to hand to a client or keep as a record that a backup or migration was complete on a given date.
- Nothing is saved for next time. Each comparison starts from scratch and needs both folders present. You cannot record the state of a folder today and check it again next month.
- Mac only. If the other copy is on a Windows PC or a Linux server, you need a different tool on that side.
Compare Folders on a Mac Without Xcode
Terminal: diff -rq
macOS includes diff, which compares two folders recursively and changes nothing:
$ diff -rq ~/Documents/project ~/Backup/project
Files /Users/you/Documents/project/notes.txt and /Users/you/Backup/project/notes.txt differ
Only in /Users/you/Documents/project: draft.docx-r recurses into subfolders and -q reports only which files differ, not every changed line. No output means the folders match. Add -x .DS_Store to ignore the Finder metadata files that otherwise show up as noise.
Terminal: SHA-256 checksum lists
To compare by content and keep a record, build a checksum list for each folder with the built-in shasum and diff the two lists:
(cd ~/Documents/project && find . -type f ! -name .DS_Store -exec shasum -a 256 {} + | sort -k2) > a.sha256
(cd ~/Backup/project && find . -type f ! -name .DS_Store -exec shasum -a 256 {} + | sort -k2) > b.sha256
diff a.sha256 b.sha256Any line that appears on one side only is a missing file or a file whose contents changed. Because the paths are relative, the second list can come from another Mac, a NAS, or a Linux server (see comparing folders on Linux).
Browser: free Folder Compare
For small folders, the free Folder Compare tool needs no install: upload two folders (up to 100 files and 50 MB each) and it hashes them in memory on our server, without storing them, and lists missing, added, and changed files.
Desktop app: FolderManifest
FolderManifest is a desktop app for macOS (Apple Silicon and Intel), Windows 10/11, and Linux that covers the cases FileMerge was not built for. It compares two folders by SHA-256 on your own machine, lists added, removed, and changed files, and exports the result as an HTML, CSV, or Markdown report. It can also save a folder manifest (every file with its path, size, dates, and hash) so you can check the same folder later, even when the other copy is gone.
What it does not do: it is not a text merge tool. It tells you which files changed, not which lines, so for reviewing and merging source code FileMerge, or git with opendiff, is still the right choice. Many people end up using both. The details for Mac, including the first-launch steps, are on the compare folders on Mac page.
| Job | Best fit |
|---|---|
| Review and merge two versions of a text or code file | FileMerge / opendiff |
| Resolve git merge conflicts visually | git mergetool -t opendiff |
| Quick check of two folders, no install | diff -rq in Terminal, or Folder Compare in the browser |
| Verify a backup or migration of photos, video, or documents | SHA-256 lists (shasum) or FolderManifest |
| Keep a report, or re-check the same folder later | FolderManifest |
Frequently Asked Questions
Where is FileMerge on my Mac?
FileMerge is inside Xcode, at /Applications/Xcode.app/Contents/Applications/FileMerge.app. Open it from the Xcode menu (Xcode > Open Developer Tool > FileMerge), search for FileMerge in Spotlight, or run opendiff in Terminal. If Xcode is not installed, FileMerge is not on the Mac.
Is FileMerge free?
Yes. FileMerge is part of Xcode, which Apple distributes free on the Mac App Store. There is no separate FileMerge download; you install Xcode to get it.
Can I get FileMerge without installing Xcode?
No. FileMerge ships only inside the full Xcode app. The smaller Command Line Tools package is not enough: the opendiff command only launches FileMerge, and it fails with a "requires Xcode" error when Xcode itself is missing.
How do I compare two folders with FileMerge?
Run opendiff folderA folderB in Terminal, or open FileMerge and drop one folder on the Left field and the other on the Right field, then click Compare. FileMerge lists the files that exist on one side only and the files that differ; open any changed text file to see the line-by-line diff.
How do I fix "tool opendiff requires Xcode"?
The active developer directory points at the Command Line Tools instead of Xcode. Install Xcode from the Mac App Store, open it once to finish setup, then run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.
How do I use FileMerge with git?
Git supports opendiff out of the box. Run git difftool -t opendiff to review changes, or git mergetool -t opendiff to resolve conflicts. To make it the default, run git config --global diff.tool opendiff and git config --global merge.tool opendiff.
Can FileMerge compare folders full of photos, PDFs, or videos?
It can tell you which files are missing on one side, but it is a text diff tool built for source code. For folders of binary files, a checksum comparison (shasum -a 256 in Terminal, or a folder comparison app) is the more reliable check.
Compare and Verify Folders on Your Mac Without Xcode
SHA-256 folder comparison, saved manifests, and shareable reports. Native on Apple Silicon and Intel, plus Windows and Linux. 7-day free trial, no card required, 30-day money-back guarantee.
