Codesign_allocate: error: cannot find the utility "codesign_allocate", not the developer tool or in PATH

I upgraded my Mac to 10.10.3 and Xcode to 6.3.1 yesterday; Today I can not use git, codesign_allocate .... and much 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` 
+7
ios xcode codesign
source share
6 answers

Try the following command:

 locate codesign_allocate 

Note. You may need to run this command and wait a couple of minutes if your local database is not updated:

 sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist 

Then look at all the points where codesign_allocate exists. On my system, it appears in the following places:

 /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 make sure that at least one of them is on your $PATH .

 echo $PATH | tr : '\n' 

On my system, /usr/bin is on my $PATH , so Xcode finds it just fine. If codesign_allocate not available on your $PATH , you have two options:

  • Add it to your path. That is, edit your ~/.bashrc and add this line to the end (note that you can use any path in which the code-name of the command exists. The path I use is just for illustration):

    export PATH=$PATH:/Library/Developer/CommandLineTools/usr/bin/

  • Create a symlink to the command line tools somewhere in the directory of your path:

    sudo ln -s /Library/Developer/CommandLineTools/usr/bin/* /usr/bin/

Hope this helps! Please note that when installing a new version of Xcode, you can return to it and make sure that you are using the correct paths. Assuming you are installing previous versions of Xcode, you should be fine, but there is something to keep in mind.

+6
source share

Have you tried if the xcodebuild command works as expected, and if you have Xcode plugins in the plugins folder located in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins , which may cause this problem.

+3
source share

I struggled with this almost the whole day and began to think that this would be the end for me.

I hope I found a solution that could help other people. I began to be surprised to see 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

I took @sandy and checked different paths where I could find codesign_allocate . I got a good tip after running both commands:

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

Thus, I just replaced the local /usr/bin/codesign_allocate with one of xcode and fixed all my problems.

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

+1
source share

Upgrading to Xcode 6.4 fixed this for me.

0
source share

Sometimes the problem is related to the launch of the Xcode command-line tool, which can be fixed by fixing the Xcode path. Check the Xcode path with xcode-select -p . If it shows the wrong Xcode path, you can use the sudo xcode-select -s PATH_TO_XCODE_DEVELOPER_FOLDER command .

For example, sudo xcode-select -s "/Application/XCode.app/Contents/Developer"

0
source share

Clear + open xcode again for me

0
source share

All Articles