Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
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. –  ؘؘؘؘ May 9 '12 at 15:39
    
TextEdit showed the error again now (with the same console output). So I'm assuming resetting the permissions didn't help... –  ؘؘؘؘ May 10 '12 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 '12 at 9:59
    
No. The logs just show local paths as file://localhost URLs for some reason. –  ؘؘؘؘ May 11 '12 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.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.