Fixing Time Machine Files

Infrequently I’ll grab something off my Time Machine. But restoring stuff from time machine can sometimes fail. For example if you are restoring a file from another computer.

I then have to resort to copying things over from the Time Machine hard drive, which causes weird permissions issue. And even if you change the user and permissions in Finder…its STILL broken!

Thankfully it is possible to fix this. I found this link about ACLs (access control lists) which talks about how there is a hidden weird os x permissions system that isn’t obvious. And then this link about file attributes talks about the fact that on the command line you can’t see if a file has ACL settings if it has an attribute set!

So how to fix a file?

First you can clear the acl like so in Terminal:

sudo chmod -N $MYFILE

And you can remove ALL attributes (maaaay need to be careful with this one) like so:

xattr -c $MYFILE

This will convert your time machine file to a ‘normal’ file.

And how to better diagnose this is the issue? If you run

ls -al
-rw-r--r--@  1 chris  staff      740 Nov 16 11:50 time_machine_file.txt

See the @?  As mentioned in the article above this @ will obscure the ‘+’ that would normally show, that tells you that an ACL controls this file. You can find out with:

ls -le .
-rw-r--r--@  1 chris  staff      740 Nov 16 11:50 time_machine_file.txt
 0: group:everyone deny write,delete,append,writeattr,writeextattr,chown

Oh hey, look at that! ‘group everyone: deny write’ that might be a problem. And now you know the fix!