OS X: Visually Compare Differences Between Two Files

Ever needed to compare two files to find the differences?  Maybe you need to do this at work.  Don’t spend any more time manually searching for these differences.  In this example, I show you how to compare two files, each with a list of characters.

This trick works best with simple text files or even XML files (like .plists).

Requirements

  1. Xcode

How To Do This

I have two files: characters1.txt  and characters2.txt .  There are a few differences between the files, but they are not immediately apparent.  Using a simple command from Terminal, you can graphically view the differences.

Run this command:

opendiff characters1.txt characters2.txt

opendiff  is part of Xcode, so if you haven’t installed it yet, this command will not work.  A program called FileMerge will open and you will see your two files compared side-by-side.

filemerge

opendiffcharacters

 

Leave a Reply