The fastest way to see what changed between two files

TextMate has a built-in file comparison tool that shows you exactly what is different between two files without opening a separate program. You select both files, run the compare command, and TextMate displays them side by side with the changes highlighted in color — additions in green, deletions in red, and modifications in yellow.

This is useful when you have two versions of the same document and need to spot what changed, or when you are reviewing edits someone else made. The comparison happens when ready and stays inside TextMate, so you do not have to switch windows or learn new software.

Key Takeaways

  • Select two files in TextMate's file browser, then use the Bundles menu to run Compare Files and see the differences highlighted by color.
  • Additions appear in green, deletions in red, and lines that changed appear in yellow so you can spot what is different at a glance.
  • The comparison opens in a new window showing both files side by side, with matching line numbers so you can follow the structure.
  • If you have only one file open, you can still compare it to another by choosing the second file from a dialog box that appears.

How to select and compare two files

Open TextMate and look at the file browser on the left side of the window. Click on the first file you want to compare, then hold down the Control key (or Command key on Mac) and click on the second file. Both files should now be highlighted.

Once both files are selected, go to the menu bar at the top and click Bundles. A dropdown menu will appear. Look for an option called Diff or Compare — the exact name depends on your TextMate version, but it will be in this menu. Click it, and TextMate will open a new window showing both files side by side.

If you do not see a Diff or Compare option in the Bundles menu, your TextMate installation may not have the comparison bundle enabled. You can enable it by going to Preferences, finding Bundles, and making sure the Diff bundle is checked.

Understanding the color coding in the comparison

When the comparison window opens, TextMate uses colors to show you what changed. Green highlighting means a line was added in the second file that does not exist in the first. Red highlighting means a line was removed — it exists in the first file but not in the second. Yellow highlighting means a line exists in both files but the content changed.

The line numbers on the left side of each file stay aligned so you can follow where changes occur. If one file has more lines than the other, you will see blank space on the shorter file's side so the line numbers stay matched up. This makes it straightforward to see not just what changed, but where it changed in the structure of the document.

Comparing a single open file to another file

If you already have one file open in TextMate and want to compare it to a different file, you do not need to select both in the file browser first. Go to Bundles and choose the compare option. A dialog box will appear asking you to select the file you want to compare against.

Click the folder icon or navigate to find the second file, select it, and click Open. TextMate will then show the comparison window with your currently open file on one side and the file you just selected on the other. This method works the same way as selecting both files first — the result is identical.

What to do if the comparison does not open

If you select two files and run the compare command but nothing happens, the most common reason is that the Diff bundle is not installed or enabled. Go to TextMate in the menu bar, then Preferences, then Bundles. Look for Diff in the list and make sure the checkbox next to it is marked.

If Diff is not in the list at all, you may need to read it. TextMate has a bundle repository you can access through Preferences. Click the plus sign to add a new bundle, search for Diff, and install it. After installation, the compare command will be available in your Bundles menu.

Another reason comparison might not work is if one or both files are in a format TextMate does not recognize — for example, binary files or very large files. TextMate works best with text-based files like code, configuration files, and documents. If you are trying to compare two image files or compiled programs, TextMate is not the right tool.

Comparing files without using the file browser

If your files are not visible in TextMate's file browser, you can still compare them. Open both files separately by going to File and clicking Open for each one. Once both are open as tabs or windows in TextMate, click on one of them to make it active, then go to Bundles and run the compare command. A dialog will appear asking you to select the second file — navigate to it and open it.

This method is slower than selecting both files at once, but it works when your files are stored in locations TextMate is not currently browsing. You can also use this approach if you want to compare a file on your computer to a file you have already opened from a network drive or external location.

Saving or exporting the comparison results

The comparison window in TextMate is temporary — it closes when you close the window, and the results are not saved. If you need to keep a record of what changed, you can take a screenshot of the comparison window, or you can copy the text from both files and paste them into a document.

TextMate does not have a built-in export function for comparisons, so if you need a permanent record, your best option is to save the comparison window as a screenshot using your operating system's screenshot tool. On Mac, press Shift-Command-4 and drag to select the window. On Windows or Linux, use the Print Screen key or your system's screenshot utility.

Frequently Asked Questions

Can I compare more than two files at once?

No, TextMate's built-in comparison tool shows only two files side by side. If you need to compare three or more files, you can run multiple comparisons one pair at a time, or use a dedicated diff tool like Kaleidoscope or Beyond Compare that handles multiple files.

What if the two files are very different and the comparison is hard to read?

The comparison will still show all the differences, but a long list of changes can be overwhelming. Try scrolling through slowly and focusing on one section at a time. If the files are too different to be useful, consider whether you are comparing the right versions — sometimes the wrong file gets selected by mistake.

Does the comparison change the files I am looking at?

No, the comparison is read-only. It shows you the differences but does not modify either file. You can safely open a comparison without worrying that TextMate will change your original files.

Can I compare files that are in different formats, like a .txt file and a .code file?

Yes, TextMate will compare any two text-based files regardless of their extension. The comparison looks at the actual content, not the file type. As long as both files contain readable text, the comparison will work.

How do I close the comparison window?

Click the X button in the top corner of the comparison window, or press Command-W on Mac or Ctrl-W on Windows and Linux. The comparison closes and you return to your regular TextMate windows.