Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

ios - codesign_allocate: error: unable to find utility "codesign_allocate", not a developer tool or in PATH

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.

`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`
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

/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.

echo $PATH | tr : '
'

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:

  1. 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/

  2. 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/

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...