“The document could not be saved”

I try not to make unreasonable complaints about the quality of software. I write software for a living, and writing bug-free software is hard. A trawl through the code I’ve written would reveal many embarrassing or annoying bugs. People in glass houses, etc.

But I do have some basic expectations of the software I use. For example, I expect that my text editor should be able to open, edit, and save files.

A screenshot of a TextMate window showing a dialog "The document 'hello.txt' could not be saved. Please check Console output for reason."

Two days ago, TextMate on my laptop decided it didn’t fancy saving files any more. Actually, it decided that ⌘+S should do nothing, and trying to click “Save” in the File menu would throw this error dialog. A trawl of Google suggests that I’m the only person who’s ever hit this error. If so, here’s a quick write-up of what I tried for the next person to run into it.

I still don’t fully understand what caused the problem, but this is what I tried to fix it:

I strongly suspect this was an overzealous security system that thought TextMate shouldn’t be allowed write access. It’s definitely one of the things that the OS X sandbox is able to limit, and it wouldn’t be the first time it’s gone on a rampage. (A few months back, it decided to block opening any text file, and I had to restore from backup.)

In years past, Apple liked to trumpet the superior security of Mac OS. But security is always a trade-off between safety and usability, and when it goes wrong like this, it leaves a sour taste in the mouth. This bug is unlikely to show up in any of Apple’s quality metrics – there’s no crash, not even an error log, but it is annoying.

I’d love to see Apple focus on bugfixes and stability in the next few releases of OS X. This sort of bug seems rare, but it would be even better if it was non-existent.