89

I am trying to archive my first iOS 4.3 Application for iPhone and I always encounter this error:

Command /usr/sbin/chown failed with exit code 1

I have searched through various forums, trying solutions such as changing the Alternate Install Group (which I don't know what to change to), and turning on 'Skip Install'.

Kara
  • 6,115
  • 16
  • 50
  • 57
Justin
  • 891
  • 1
  • 6
  • 3
  • Can you open the log tab (the speak bubble tab), select the build log and then expand the chmod line that is failing and include the full command and output in the question? – Mattias Wadman Jun 18 '12 at 16:02

13 Answers13

135

As dumb as it sounds, in XCode 5.1.1, all I had to do was quit out and restart XCode just now. I know it's not much of an "answer" but it just worked for me.

Edit: this is still working as of July 2018 for folks. Edit: this is still working as of January 2019 xcode 9.4.1 Edit: this is still working as of February 2023 xcode 14.2

Jake
  • 2,126
  • 1
  • 10
  • 23
Dan
  • 5,153
  • 4
  • 31
  • 42
  • This is a bug with Xcode (still going strong in 8, apparently!)—in my case, it had incorrect values from another project I had open in the `Install Owner` and `Alternate Install Owner` fields. As others have said, quitting Xcode, restarting it, and doing the clean and clean build folders procedures fixed it for me. – Evan R May 28 '17 at 15:38
  • I'm not sure how many times I've come here to find this answer but based on my browser history this appears to be the 3rd time. This still works in 10.2.1. If someone wants to actually fix this, my issue is that chown fails because my company is using AD group names like "CORP\Domain Users" which is not a valid name. – Daniel Smith Sep 24 '19 at 00:45
  • 1
    Xcode 11.3.1, still works. However, with a twist. I had no problem when I was using my MacBook at work, but would get this error when I tried to archive while at home. BUT-- it would then work fine if I VPN'd to our work server from home. Very weird. – Bill Norman Mar 31 '20 at 19:53
  • 1
    2022, XCode 14, still working – Climbatize Oct 04 '22 at 09:59
  • 1
    Xcode 13.2.1 , fixed by restarting Xcode. – Eklavyaa Dec 10 '22 at 05:07
  • Xcode 14.3.1, Same fix: just restart, and maybe clean build folder too. But yes, it works! – Apekshik Panigrahi Jun 26 '23 at 19:27
87

enter image description here

I was having difficulty with the SetOwnerAndGroup part of Archiving - I was getting /usr/sbin/chown failed, and it was getting 'operation not permitted' on each file it tried to 'chown'.

This was easily tested in the terminal - 'chown' doesn't work, but 'sudo chown' does. Since I had no need to be changing file permissions, the simplest solution was to not do the chown.

The screenshot above shows - I just blanked out Install Owner/Group, and that did it.

adalle
  • 1,039
  • 7
  • 6
  • 8
    Also make sure that when you have any subprojects/libraries in your project (i.e. CordovaLib), to also blank out the Install Owner/Group there. – tschoffelen Feb 16 '13 at 14:02
  • 5
    thanks this was exactly what I needed! But Im wondering why I need this. Yesterday it worked, today not. Of course I had also to blank out the _Install Permissions_ – Phil May 27 '13 at 08:00
  • If in a corporate environment this can happen and this posting fixes it. Top notch. – ort11 Nov 20 '13 at 17:39
  • Normally I wouldn't think doing this step should be necessary, but it does fix the problem. I've come back to this answer a couple times. – funroll Jun 05 '14 at 15:30
  • yes indeed. After trying a few other things this was the problem solver. – Moonwalker Apr 02 '15 at 08:00
  • I had the similar issue. This helped like a charm. – user2900761 Oct 18 '17 at 15:37
61

When I got this error, rebooting my computer fixed it.

dl.
  • 2,264
  • 1
  • 19
  • 22
24

I have tried all the other solutions but none of them worked for me. So I have run this on a terminal to change the owner to me on every file in my project:

sudo chown -R my_username:my_group ./my_project_folder

where "my_username" is you username, "my_group" is your group (this is usually staff) and "my_project_folder" your project's folder.

Spyros El.
  • 423
  • 3
  • 13
6

None of the other solutions worked for me on Xcode 4.5. What I had to do was the following:

The fix is by removing the armv6 architecture from both your project and the CordovaLib project, clean both projects, and rebuild.

Source

Bashevis
  • 1,507
  • 16
  • 21
  • 2
    To elaborate these steps: in Xcode, click on your project, go to Build Settings tab, under Architectures there must be only armv7 written. Do the same for the CordovaLib project (it's in the left pane, the same as your project). Than clean both projects using Product -> Clean. This worked for me also, fixed my problem. – duality_ Oct 08 '12 at 16:42
2

To it works in my environment I cleaned all information about permission, as +adalle said, complemented by Tom and Phil

I emptied the fields Install Group, Install Owner, Install Permission including the Cordova SubProject

Community
  • 1
  • 1
Helder Robalo
  • 1,827
  • 2
  • 13
  • 16
2

enter image description hereI had the same issue with Xcode . It started working after restarting Xcode. In the screenshot , Xcode ->build settings , installed group was empty after restarting Xcode .the group id it has showed as some number.

Kishor
  • 376
  • 4
  • 14
1

I tried all possible variants and they didn't help me. So I downloaded old XCode 4.4.1 and voila - application archived successfully :)

1
  1. Select the target that's giving you the error
  2. Change Build Active Architecture Only from Yes to No

That worked for me.

funroll
  • 35,925
  • 7
  • 54
  • 59
1

For me reboot my mac fixed it. OS High Sierra, xCode 9.2

Thafer Shahin
  • 814
  • 9
  • 10
1

Not sure if this is the same problem you are having, but this fixed it for me:

When I created my XCode project, my app name had a space in it, so trying to deploy my app always failed. I was able to fix this by using a Custom Archive Name.

In XCode 4...

  1. Edit the Deployment Scheme
  2. Click on the Archive tab
  3. Then specify an Archive Name that doesn't have spaces in it.

Specify a Custom Archive Name

Andrew
  • 227,796
  • 193
  • 515
  • 708
0

When this happens to me on Xcode 8, I do "Clean build folder" 2 times (the first time it throws an error, but the second time succeeds) and then archive again.

Note: The "Clean build folder" option is under "Product" Menu, hold the alt button and you will see the "Clean" option changing to "Clean build folder".

quarac
  • 3,454
  • 3
  • 21
  • 25
0
  • Clean your project.
  • Clean your build Folder. (Product > ⌥ > Clean Build Folder)
  • Set the target device to Generic iOS Device .

enter image description here

johnny
  • 555
  • 4
  • 16