Xcode: "The document cannot be saved. You do not have permission."

I get this error when I try to save a file in Xcode 4: "The document cannot be saved. You do not have permission. To view or change permissions, select an item in Finder and choose File> Get Info.

Naturally, saving a file in TextMate is wonderful. Permissions: -rw-rr -

Nothing changed when he last worked. The files are not locked, I tried rebooting, the disk space is in order, the files are on the local disk, the error was launched. Any ideas?

Thanks.

Update: also tried to copy files or rename them. Directories are not locked. By the way, when I edited the project configuration in Xcode, this saves excellent, I just met the problem of saving .m / .h files. I assume copying the actual text in the files will work, but I'm trying to find a slightly less hardcore solution (a bash script will not be a problem, but there may be other problems). This is not the easiest project (~ 70 files, edited config).

Update 2: a possible duplicate found doesn’t really solve the problem Can't unlock the file for editing in Xcode 4?

Update 3: The commit was checked earlier, and when you open Xcode it says that the project is locked. You also checked the same message and the error will not appear again (all files other than DS_Store are tracked). What.

Update 4: I created a new user and installed chmod -R 777 in the project directory. Editing now works great. However, I cannot get it to work under my main account (I have all my settings here.)

+6
source share
7 answers

Corrected by changing the account name following this guide . This essentially creates a new account, but with your old home directory and in the process of transferring it fixes some file permissions.

(From the link above :)

For Mac OS X version 10.5 or later (do this twice if you want to keep your original username)

  • Enable root user .
  • Log in as root.
  • Go to the / Users folder.
  • Select the home folder with the short name that you want to change, and rename it the same way as if you renamed any folder. Keep in mind that the short name must be lowercase, with no spaces, and contain only letters.
  • Use the Users and Groups panel (Accounts panel in Mac OS X 10.6.8 or earlier) in System Preferences to create a new user with the account name or abbreviated name that you used in the previous step.
  • Click “OK” when “The folder in the Users folder already has the name“ account name. ”Do you want to use this folder as the Home folder for this account?" Note. This will fix the ownership of all files in the home folder and avoid problems with the contents.
  • Select "Exit Apple Menu."
  • Log in as the newly created user. You must have access to all source files (on the desktop, in documents, and in other folders of this house).
  • After verifying that your data is expected, you can delete the original user account in the Users and Groups panel (Accounts panel in Mac OS X version 10.6.8 or earlier).
  • Disable the root user.
+2
source

Reboot fixed the error in my case.

+6
source

Xcode 6 update : still seeing this problem.

It seems that the Xcode error, because opening the file by clicking the error in the Issue navigator causes this problem, but if I open the file using cmd + shift + O, I can edit and save it. So for me, the workaround is to not open the file by selecting the error and opening it using the Project navigator or Open quickly shortcut.

+2
source

I upgraded to Lion and downloaded the new Xcode and found the same problem and found nothing to lose for about three days trying to fix this. Then I realized that Xcode 4, which is saved in the Applications folder, does not overwrite Xcode 3, which is in the Developer folder. When I opened Xcode, I opened version 3, not 4.

Make sure you open the correct version.

+1
source

open the terminal and install

  chmod 777 

to the desired file or install

  chmod -R 777 

to the desired directory.

he must solve your problem

0
source

I also ran into this problem. I could not fix this without changing the permissions of a single project file or folder. However, I was able to fix this by going to “get information” in the user's home folder, re-selecting the “Read and write” permissions for my user, and then clicking the gear → “for private items”. I took this time, but then everything worked as expected. Hope this helps someone else.

0
source

It may be useful if you are using CocoaPods: fooobar.com/questions/707006 / ...

I am running Xcode 7.3 and CocoaPods 1.0.0. and this happens when you try to modify a file from a package added as a development module (i.e. from a local directory).

I just update the update, when the pod is finished, Xcode will display a warning “Unsaved changes were saved to the document”. Then click Restore. which fix my problem.

0
source

Source: https://habr.com/ru/post/901023/


All Articles