MacOS – The document “x” could not be saved. You don’t have permission

autosavemacospermission

I am getting the following error:

The document could not be saved. You don't have permission

The error is not helpful at all because it does not point to where I don't have permission. To save the file, I need to Duplicate it each time, which is very painful. This time the error is from CleanWriterPro, but I have also received it from Numbers and TextEdit. Saving with TextMate works fine.

Permissions to the file are set up correctly according to Finder.

I think this must be some kind of problem with AutoSave permissions but despite googling with the error, I have not yet figured out what's wrong.

I found one possible culprit for this problem for me:

grant:Library joneskoo $ pwd
/Users/joneskoo/Library
grant:Library joneskoo $ ls -lad Autosave\ Information/
drwx------  2 root  staff  68 Sep 25  2010 Autosave Information/

Since Library is hidden in Lion, it needs to be made visible before the permissions can be fixed in Finder:

chflags nohidden ~/Library

After unhiding the Library, I opened the Get Information for Library, clicked the lock and selected "Apply to enclosing items" so that all files in Library made owned by me and no permissions for others.

However, CleanWriterPro is still not able to save the file in Documents, even though I repeated the step for Documents and Desktop. I could not reproduce the problem in Numbers now.

Repairing Disk permissions did not help.

Possibly related: I can't even rename files in Finder now under Documents without typing my password. Techrepublic: Introduction to OS X access control lists.

grant:~ joneskoo $ ls -led Documents/
drwxr-xr-x+ 44 joneskoo  staff  1496 Jan 17 06:55 Documents/
 0: group:everyone deny delete

I don't know what introduced that ACL, Finder? How can I remove it?

The question is: what are all the places I need to check to fix this problem?

Best Answer

I was able to fix the problem for CleanWriterPro by removing extended ACL from the affected directories (Documents, Desktop):

$ chmod -R -N Desktop Documents

For others with the same problem, I'd suggest checking the permissions of at least the following places:

  • ~/Library/Autosave Information
  • ~/Library/Containers – see Unsaved Files in OS X Lion
  • the folders containing the problematic files

Use the command

$ ls -le Documents

to show also the extended ACLs when looking at the problem. Finder will not show all ACL information.

There is a related discussion at Apple Discussion Forums, Lion Permissions Problem. It proposes the solution of removing all ACL from home directory and restoring the ACLs for some default folders. Please read the entire post from there; but the commands are:

chmod -R -N ~
chmod +a "everyone deny delete" ~/ ~/Desktop ~/Documents ~/Downloads ~/Library ~/Movies ~/Music ~/Pictures ~/Public

The ACL prevents the user from deleting or renaming the default folders.

An unintuitive but maybe safer(?) alternative is described at OS X Daily: Repair user permissions in Mac OS X Lion