xcode codesign_allocate:错误:无法找到实用程序“codesign_allocate”,不是开发人员工具或在 PATH 中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29848622/
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
codesign_allocate: error: unable to find utility "codesign_allocate", not a developer tool or in PATH
提问by six
I upgraded my Mac to 10.10.3 and Xcode to 6.3.1 yesterday; today I can't use git, codesign_allocate
....and more.
我昨天将 Mac 升级到 10.10.3,将 Xcode 升级到 6.3.1;今天我不能使用 git,codesign_allocate
......等等。
`sh: line 1: 18421 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -find codesign_allocate 2> /dev/null
codesign_allocate: error: unable to find utility "codesign_allocate", not a developer tool or in PATH
/Users/ylx/Library/Developer/Xcode/DerivedData/test-ahpvhmtqeafuveekexklyxulvmfa/Build/Products/Debug-iphoneos/test.app/Frameworks/libswiftCore.dylib: the codesign_allocate helper tool cannot be found or used
*** error: Couldn't codesign /Users/ylx/Library/Developer/Xcode/DerivedData/test-ahpvhmtqeafuveekexklyxulvmfa/Build/Products/Debug-iphoneos/test.app/Frameworks/libswiftCore.dylib: codesign failed with exit code 1
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool failed with exit code 1`
回答by Sandy Chapman
Try running the following command:
尝试运行以下命令:
locate codesign_allocate
Note, you may need to run this command and wait a couple minutes if your locate DB isn't updated:
请注意,如果您的定位数据库未更新,您可能需要运行此命令并等待几分钟:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
Then see all the spots where codesign_allocate
exists. On my system, it shows up in the following locations:
然后查看所有codesign_allocate
存在的点。在我的系统上,它显示在以下位置:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
/Library/Developer/CommandLineTools/usr/bin/codesign_allocate
/usr/bin/codesign_allocate
Then ensure at least one of these is on your $PATH
.
然后确保其中至少一个在您的$PATH
.
echo $PATH | tr : '\n'
On my system, /usr/bin
is on my $PATH
, so Xcode finds it just fine. If codesign_allocate
isn't available on your $PATH
, you've got two options:
在我的系统上,/usr/bin
在我的$PATH
.x上,所以 Xcode 发现它很好。如果codesign_allocate
在您的 上不可用$PATH
,您有两个选择:
Add it to your path. I.e. edit your
~/.bashrc
and add this line to the end (Note, you can use any path that codesign_allocate exists on. The path I'm using is just to illustrate):export PATH=$PATH:/Library/Developer/CommandLineTools/usr/bin/
Create a symbolic link to your command line tools somewhere on a directory in your path:
sudo ln -s /Library/Developer/CommandLineTools/usr/bin/* /usr/bin/
将其添加到您的路径中。即编辑你的
~/.bashrc
并将这一行添加到最后(注意,你可以使用任何存在 cosign_allocate 的路径。我使用的路径只是为了说明):export PATH=$PATH:/Library/Developer/CommandLineTools/usr/bin/
在路径中某个目录的某处创建指向命令行工具的符号链接:
sudo ln -s /Library/Developer/CommandLineTools/usr/bin/* /usr/bin/
Hope this helps! Note, on installation of a new Xcode version, you may want to revisit this and ensure you're using the correct paths. Assuming you install over previous versions of Xcode, you should be okay, but it's something to keep in mind.
希望这可以帮助!请注意,在安装新的 Xcode 版本时,您可能需要重新访问并确保使用正确的路径。假设您安装了以前版本的 Xcode,您应该没问题,但要记住这一点。
回答by Atika
Have you tried if xcodebuild
command work as expected and if you have any Xcode pluginsin the plugins Folder located at ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins
who can cause this issue.
您是否尝试过xcodebuild
命令是否按预期工作,以及位于谁可能导致此问题的 plugins 文件夹中有任何Xcode 插件~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins
。
回答by Lifely
I struggled with this almost all afternoon and started to think it would be the end for me.
我几乎整个下午都在为此苦苦挣扎,并开始认为这对我来说将是结束。
Hopefully I found a solution that might help other people. I started to wonder after I saw this error again and again :
希望我找到了一个可以帮助其他人的解决方案。一次又一次看到这个错误后,我开始怀疑:
sh: line 1: 18421 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -find codesign_allocate 2> /dev/null
codesign_allocate: error: unable to find utility "codesign_allocate", not a developer tool or in PATH
sh: line 1: 18421 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -find codesign_allocate 2> /dev/null
codesign_allocate: error: unable to find utility "codesign_allocate", not a developer tool or in PATH
I took @sandy's answer and checked the different paths where I could find codesign_allocate
. I got a pretty good hint after running both of these command:
我接受了@sandy 的回答并检查了我可以找到的不同路径codesign_allocate
。运行这两个命令后,我得到了一个很好的提示:
$ /usr/bin/codesign_allocate
sh: line 1: 26890 Abort trap: 6 ...
$ /usr/bin/codesign_allocate
sh: line 1: 26890 Abort trap: 6 ...
$ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
Usage: .../codesign_allocate -i input [-a <arch> <size>] [-A <cputype> <cpusubtype> <size>]... -o output
$ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
Usage: .../codesign_allocate -i input [-a <arch> <size>] [-A <cputype> <cpusubtype> <size>]... -o output
Thus I simply replaced my local /usr/bin/codesign_allocate
with the one from xcode and that fixed all my problems.
因此,我简单地用/usr/bin/codesign_allocate
xcode 中的一个替换了我的本地,并解决了我所有的问题。
sudo cp -r /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate /usr/bin/
sudo cp -r /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate /usr/bin/
I hope this can help other people; good luck everybody.
我希望这可以帮助其他人;祝大家好运。
回答by C. Bess
Upgrading to Xcode 6.4 fixed it for me.
升级到 Xcode 6.4 为我修复了它。
回答by Khushneet
Sometimes issue is with path of Xcode's command line tool which could be fixed by fixing path of XCode. Please check path of XCode with command xcode-select -p. If it shows incorrect XCode path then you can use command sudo xcode-select -s PATH_TO_XCODE_DEVELOPER_FOLDER.
有时问题出在 Xcode 命令行工具的路径上,可以通过修复 XCode 的路径来修复。请使用命令xcode-select -p检查 XCode 的路径。如果它显示不正确的 XCode 路径,那么您可以使用命令 sudo xcode-select -s PATH_TO_XCODE_DEVELOPER_FOLDER。
For example, sudo xcode-select -s "/Application/XCode.app/Contents/Developer"
例如,sudo xcode-select -s "/Application/XCode.app/Contents/Developer"
回答by Khushneet
Clean up + reopen xcode worked for me
清理 + 重新打开 xcode 对我有用