Every now and then, some application (usually TextEdit) starts showing dialogs like this when I try to close or save any document:

The document “2.txt” could not be autosaved.

Your changes will not be saved until the problem is resolved. You can also duplicate the document or discard your changes to close it.

I'll have to quit and reopen the application in order to save anything again.

  • I have disabled both Resume and locking files automatically in System Preferences
  • The files have usually been in normal folders under my home folder and there hasn't been anything special about them as far as I can tell
  • I have tried repairing permissions
  • TextEdit's code signature is valid

system.log usually has usually contained messages like this:

5/8/12 9:04:01.358 PM [0x0-0x17b17b].com.apple.TextEdit: [ERROR] GSLibrary.c:_AddGenerationInternal:393  Failed to consume sandbox extension; error 12 (Cannot allocate memory)
5/8/12 9:04:01.361 PM TextEdit: NSFileVersion tried to tried to add a new generation and failed. Versioned file URL: file://localhost/Users/lauri/Notes/2.txt, contents URL: file://localhost/Users/lauri/Notes/2.txt, error: Error Domain=GSLibraryErrorDomain Code=1 "The operation couldn’t be completed. (GSLibraryErrorDomain error 1.)" UserInfo=0x10b24d070 {}
5/8/12 9:04:01.362 PM TextEdit: NSDocument failed to preserve the old version of a document. Here's the error:
Error Domain=GSLibraryErrorDomain Code=1 "The operation couldn’t be completed. (GSLibraryErrorDomain error 1.)" UserInfo=0x10b24d070 {}

Failed to consume sandbox extension; error 12 (Cannot allocate memory)? Does anyone know what's going on here?

Edit: I haven't seen those errors after I replaced TextEdit with TextEditPlus. It's based on TextEdit's source code but it disables sandboxing and makes a few other changes.

4 Answers 4


It seems that this is actually a bug in Apple's sandboxing implementation. This means that none of the steps above should help. We had the same console output in one of our applications (including the inability to save text) and spent quite some time on finding the cause of the bug (see this radar). From what we've found out, it seems that after retrieving the recently opened documents for a number of times, the application cannot save files anymore because it does not get the permission to do so. You could try clearing the recently used documents menu, maybe this helps.

  • Clearing Pages' "Open Recent" menu fixed this problem for Pages 8.1 under macOS 10.14.6
    – Seth Noble
    Oct 6, 2019 at 22:27
  • This doesn't work for me on TeXShop on macOS 12.1.
    – Rain
    Mar 2, 2022 at 23:59

There's, in Lion, a hidden way of repairing permissions, which seems to be even more effective:

  1. Restart Lion, and Before you hear the chime, hold down Cmd + R, to access Lion Recovery.
  2. Click the Utilities item in the Menu Bar, then click Terminal.
  3. In the Terminal window, type resetpassword and hit Return.
  4. The password reset utility window launches, but you’re not going to reset the password. Instead, click on icon for your Mac’s hard drive at the top. From the dropdown below it, select the user account where you’re having issues.
  5. At the bottom of the window, you’ll see an area labeled Reset Home Directory Permissions and ACLs. Click the Reset button there.

It seems that this feature fixed the same problem to Dwight Silverman. Guess it's worth giving a try.

Apparently, repairing permissions with Disk Utility, as usual, does not repair Users file permissions.

  • I tried it, even though the permissions and owners of the files were completely normal. I'll accept this answer if I don't run into those dialogs in a week or so.
    – Lri
    May 9, 2012 at 15:39
  • TextEdit showed the error again now (with the same console output). So I'm assuming resetting the permissions didn't help...
    – Lri
    May 10, 2012 at 16:37
  • Are you working with a file which is not in your local machine? A file in iDisk or a Shared folder, perhaps?
    – Thecafremo
    May 11, 2012 at 9:59
  • No. The logs just show local paths as file://localhost URLs for some reason.
    – Lri
    May 11, 2012 at 17:19
  1. Select all the text in the document to clipboard (Command + A
  2. Quit and choose to discard changes to document.
  3. Reopen the document.
  4. Select all that is in document (now an old copy).
  5. Paste the material that was previously copied out.
  6. Now save the new, and complete document.

Copy the content and paste it into another document of the same type.

In Keynote, select all of the slides in Navigator view and drag them into the same pane of a new document.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .