我昨天将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`
解决方法
尝试运行以下命令:
locate codesign_allocate
注意,如果您的locate DB未更新,您可能需要运行此命令并等待几分钟:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
然后查看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
然后确保其中至少有一个在$PATH上.
echo $PATH | tr : '\n'
在我的系统上,/usr/bin在我的$PATH上,所以Xcode发现它很好.如果$PATH上没有codesign_allocate,您有两个选择:
>将其添加到您的路径中.即编辑你的〜/ .bashrc并将这一行添加到最后(注意,你可以使用任何存在codesign_allocate的路径.我正在使用的路径只是为了说明):
export PATH = $PATH:/ Library / Developer / CommandLineTools /usr/bin /
>在路径中某个目录的某处创建指向命令行工具的符号链接:
sudo ln -s / Library / Developer / CommandLineTools /usr/bin/* /usr/bin /
希望这可以帮助!请注意,在安装新的Xcode版本时,您可能需要重新访问它并确保使用正确的路径.假设你安装了以前版本的Xcode,你应该没问题,但要记住这一点.