xcode 命令 /usr/sbin/chown 失败,退出代码为 1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17049564/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Command /usr/sbin/chown failed with exit code 1
提问by David Welsh
I know this has been covered quite a lot, but I've been googling and trying things for almost 2 days straight now with no luck from the current solutions.
我知道这已经被覆盖了很多,但是我已经用谷歌搜索并尝试了近 2 天,但目前的解决方案没有任何运气。
I'm using XCode 4.6.2 to create a PhoneGap application, which currently builds to a device and simulator no problem. However, when I try to archive the file, I get the error message:
我正在使用 XCode 4.6.2 创建一个 PhoneGap 应用程序,该应用程序目前可以构建到设备和模拟器上,没有问题。但是,当我尝试存档文件时,收到错误消息:
Command /usr/sbin/chown failed with exit code 1
命令 /usr/sbin/chown 失败,退出代码为 1
It also lists every file in my www folder that I'm trying to compile as follows:
它还列出了我正在尝试编译的 www 文件夹中的每个文件,如下所示:
chown: /my/folder/path/appName.app/www/filename.abc: Operation not permitted
chown: /my/folder/path/appName.app/www/filename.abc: 不允许操作
I've tried setting the "Build Active Architecture Only" to yes, for both the main project and the included PhoneGap project.
对于主项目和包含的 PhoneGap 项目,我已经尝试将“仅构建活动架构”设置为是。
I've tried combinations of different architectures. Currently removed armv6 & armv7s. Only armv7 remains at the moment.
我尝试过不同架构的组合。当前已删除 armv6 和 armv7s。目前只剩下 armv7。
It seems like a permission problem, but I've gone in via the terminal and doubly made sure I have full rights to the folder. I'm using the main admin user account.
这似乎是一个权限问题,但我已经通过终端进入并双重确保我拥有对该文件夹的完全权限。我正在使用主管理员用户帐户。
I did notice however, that when I go to the terminal and type:
然而,我确实注意到,当我去终端并输入:
sudo chown -R userName /path
须藤 chown -R 用户名/路径
I get the exact same error as xcode produces.
我得到与 xcode 产生的完全相同的错误。
It's my first experience using a Mac in general, let alone xcode, so there might be something fundamental that I'm missing too.
这是我第一次使用 Mac,更不用说 xcode,所以我也可能缺少一些基本的东西。
I opened up a hello world app to try archiving it, and that worked without any problem.
我打开了一个 hello world 应用程序来尝试归档它,并且没有任何问题。
I've tried the small things like cleaning and rebooting.
我已经尝试过一些小事情,比如清理和重启。
Thank you.
谢谢你。
回答by Jorre
This problem is caused because some of your files (the ones that throw the chmod in xcode) don't have the proper owner/group set. They probably are set with root permissions, which can be caused by installing e.g. PhoneGap modules with sudo.
这个问题是因为你的一些文件(那些在 xcode 中抛出 chmod 的文件)没有正确的所有者/组集。它们可能设置了 root 权限,这可能是由于使用 sudo 安装例如 PhoneGap 模块造成的。
Run a sudo chown -R username:staff YourAppFolder
command on your original files and you will be able to archive your code again.
sudo chown -R username:staff YourAppFolder
对原始文件运行命令,您将能够再次存档代码。
回答by Paul Diston
Have you developed some of your Phone Gap app on a Windows machine? You may need to set your files be not read only on your Windows machine before you copy them to your Mac.
您是否在 Windows 机器上开发了一些 Phone Gap 应用程序?在将文件复制到 Mac 之前,您可能需要在 Windows 机器上将文件设置为不只读。
回答by Andrea
If you are encountering the errors above with some files, probably it's because Xcode is tryng to chown the .app created and it can't change the permissions of some files.
如果您在处理某些文件时遇到上述错误,可能是因为 Xcode 正在尝试 chown 创建的 .app 并且它无法更改某些文件的权限。
If you read the log of the errors, in the previous lines you wull see that there is a line starting with chown [....] .app
如果您阅读错误日志,在前几行中您会看到有一行以 chown [....] .app 开头
- copy that line
- open the terminal
- type: sudo [paste the line copied]
- insert your admin password
- Archive again.
- 复制那行
- 打开终端
- 类型:sudo [粘贴复制的行]
- 输入您的管理员密码
- 再次存档。
It fixed for me.
它为我修好了。
(Same thing if you have chmod errors)
(如果你有 chmod 错误,同样的事情)