I occasionally run into weird permission problems after a restore of files and folders on my machine, I think it has to do with OSX trying to protect me from myself.

Today I needed to fire up my coding environment on my Mac Mini, so I jumped into the folder for the code that I wanted to update using SourceTree, and did (what I thought was going to be) a quick pull, only to get a weird error message.

I figured it was probably something goofy, so I went to the command line, only to get another weird error:

Well, I’ve seen that before, and knew that message was probably because I’ve updated the OS a few times since I last coded. Basically it means the XCode command line tools are missing. Fixing that is easy: just run:

This fires up the Xcode installer, which will ask you if you want to install Xcode, or just the command line tools. In this case I don’t need Xcode, so I chose the latter.

That took a pretty long time (it was on “about a minute left” for at least 10 minutes), which was a bit worrisome, but not all that unusual.

Going back to the command line, I tried to do my “git pull” only to get another error:

OK, weird – why can’t it write that. Found a few things online that suggested running “git gc” might fix it, so I tried that, but that just gave me this error:

More curious Googling, and finding the suggestion to look at the extended file permissions, so I tried that:

Wait, what’s this “group:everyone deny delete” ? Well, no wonder I can’t run stuff that updates these folders. More Googling and I find the right switch for chmod to clear out the extended permissions:

Note that I had the two flags reversed the first time and the command told me it couldn’t find a file named “-R”. After running the above, the folder permissions looked more normal:

And my commands worked as expected.