MacOS – Is it possible to prevent TextEdit’s “The file has been changed” dialog from appearing unnecessarily

dialogmacostextedit

Every so often, I will be doing something on my computer (e.g., in Google Chrome), when an alert dialog from TextEdit.app randomly pops up. The dialog looks like this:

The dialog asks if I want to save changes made to an open or minimized RTF document in TextEdit. The dialog sometimes appears even when TextEdit is not the active application; the dialog comes out of nowhere.

My answer to this dialog, 100% of the time, is Save Anyway. This is because hitting the Revert button irrevocably changes the file to the last-saved version of the file (which is obviously undesirable).

  1. If the document is not being edited in another application, then why does this message appear? Or, how can I figure out which application (i.e., "another application") is responsible for the changes to the document, exactly?

  2. Is it possible to prevent this dialog from needlessly appearing? Or, is it possible for Textedit to "save anyway," by default?

OS X El Capitan, version 10.11.6.

Best Answer

I've never seen this sheet without the underlying file being changed. Try opensnoop on the file to determine the process which is accessing the file:

$ sudo opensnoop -f /path/to/file.txt
  UID    PID COMM          FD PATH
  501  32092 Finder        14 /path/to/file.txt
    0     81 mds           28 /path/to/file.txt
  501  41898 mdworker       9 /path/to/file.txt
  501  42646 TextMate      16 /path/to/file.txt
  501  42646 TextMate      16 /path/to/file.txt
  501  42646 TextMate      25 /path/to/file.txt
  501  42646 TextMate      26 /path/to/file.txt

This is a live printout, so keep the opensnoop running until you get the sheet, then check your Terminal window and look back to see the process. ⌃C stops opensnoop when you're finished. You will need to disable System Integrity Protection to use opensnoop and can be re-enabled afterwards.