title: Xcode: "The document could not be saved. You don’t have permission."
body: <p>I'm getting this error when trying to save a file in Xcode 4:
  "The document could not be saved. You don’t have permission. To view or change permissions, select the item in the Finder and choose File > Get Info."</p>
  
  <p>Naturally, saving the file in TextMate works fine. Permissions: -rw-r--r--</p>
  
  <p>Nothing changed from when it worked the last time.
  Files are not locked, I tried rebooting, disk space is ok, files are on a local drive, error was googled. Any ideas?</p>
  
  <p>Thanks.</p>
  
  <p>Update: Also tried copying the files or renaming them. Directories are not locked. By the way, when I edited project configuration in Xcode it saves fine, I only met with the issue saving .m/.h files. I guess that copying the actual text in the files would work but I'm trying to find a bit less hardcore solution (bash script wouldn't be the issue but there could be other problems). It's not the simplest project either (~70 files, edited config).</p>
  
  <p>Update 2: Found possible duplicate, doesn't really resolve the problem <a href="https://stackoverflow.com/questions/7139780/unable-to-unlock-file-for-editing-in-xcode-4">Unable to unlock file for editing in Xcode 4?</a></p>
  
  <p>Update 3: Checked out earlier commit and when opening Xcode it said the project is locked. Checked out the same commit again and the error does not appear again (all files exc. DS_Store are tracked). What.</p>
  
  <p>Update 4: I created a new user and set chmod -R 777 to the project directory. Editing now works fine. However I can't get it to work under my main account (I have all my preferences here.)</p>