58

I get the following error messages when I moved my code from my laptop to my Mac Mini and opened it over there:

myProject is locked for editing and you may not be able to save your changes?


myProject is currently locked because you are not the owner of the file and do not have write permission.


The file "xxx.xcuserdatad" could not be unlocked. Could not add write permission to the file because you do not own it. Try modifying the permission of the file in the Finder or Terminal.


I did a search with Finder: What came up was a file called UserInterfaceState.xcuserstate inside of xxx.xcuserdatad... GetInfo showed the file not to be locked.

However looking at the path(from GetInfo) showed the file to be within "xxx.xcodeproj" and further within "project.xcworkspace/xcuserdata/xxx.xcuserdatad"

I can't find this anywhere, and I don't know how to use my project on another computer.

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
Woof
  • 699
  • 1
  • 5
  • 9

4 Answers4

103

Go to the Folder in Finder where the xcode project is and right click -> Get info. The permissions and the bottom should be set to read/write and in my case they were. The trick is to click the settings icon at the bottom and select "Apply to enclosed items". The chmod method shown above doesn't change the permissions of the contents within the folder.

user2848810
  • 1,187
  • 1
  • 8
  • 12
  • 1
    This worked for me and was far easier that messing around in the terminal. Thanks! – Smikey Oct 22 '13 at 12:08
  • 2
    This is the best solution. For those looking to resolve this in 10.9 (Mavericks), it works the same way: Select Folder, right-click, Get Info, Scroll to very bottom, Select the "Padlock" on the lower right corner, Open with your password, then select the settings "Gear" with the drop down to the right of the +/- stepper button, and then select "Apply to enclosed items..." It is key to also make sure the "User" you are signed it as, has the (read/write) privilege. – Newbyman Dec 20 '13 at 19:57
  • Thanks . . .I had to unlock the folder using admin powered user name and password – Karan Alangat May 19 '15 at 09:34
  • 4
    I am using OSX Sierra and Xcode 8. But changing the permissions via Get Info does not have a "Apply to enclosed items" option after clicking on the settings icon. Why? – dmonaldo Oct 06 '16 at 21:29
  • This is the cleanest, most accurate solution I've seen for this issue. Thanks. – user3286381 Dec 25 '16 at 06:32
  • In my case it worked but only after I set "staff" to read/write too. – Olivier de Jonge Sep 08 '17 at 09:50
  • @dmonaldo I am using High Sierra, have the same issue too – Zubli Quzaini Apr 18 '18 at 12:14
  • 3
    @ZubliQuzaini The "Apply to enclosed items" option is only available for directories. I was able to fix it by changing permissions on the parent directory instead of the .xcodeproj. Or use the chown command with the -r recursive flag set. – dmonaldo Apr 19 '18 at 17:02
32
  1. go to the folder in finder
  2. right click on folder and click the "Get info"

enter image description here

  1. go down to the bottom and click the lock and write administrator password

enter image description here

  1. now click on the settings icon and press "Apply to enclosed items..."

enter image description here

Rami Nour
  • 2,035
  • 1
  • 14
  • 11
20

Please note that I had to add the recursive command flag and sudo to get it to work for me:

$ sudo chown -R Joe my_app_folder/*

And:

$ sudo chmod -R 774 my_app_folder/*

Because I was getting this error:

chmod: Unable to change file mode on my_app_folder: Operation not permitted

user8128167
  • 6,929
  • 6
  • 66
  • 79
6

Have you tried copying the contents like suggested in this answer?: Unable to unlock file for editing in Xcode 4?

Alternatively you could use the console to set yourself a writing permission on all the files for your xcode project:

http://www.mac-terminal.com/files-and-folders/permissions/chmod/

Community
  • 1
  • 1
Pochi
  • 13,391
  • 3
  • 64
  • 104