OHO's Blog

My 2 cents about everything!

Codesign Useful Info in XCode 5.0.1

If you are using codesigning scripts for handling some iOS apps re-signing, you might already have found that you need to set codesign_allocate environment variable.

It appears that depending on Xcode releases, valid codesign_allocate version are not always at the same location.

Here is a quick tip on what to setup…

If you have recently updated you Xcode version and your favorite re-signing script sudently does not work. And while codesigning with -vvvv your script get screwed up with:

code failed to satisfy specified code requirement(s)

or while –verify(ing) your bundle, you get:

invalid resource directory (directory or signature have been modified)

then it might be possible that you have to change codesign_allocate path on your environment variable.

Codesign_allocate paths

Xcode < 5.0:    /Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate
Xcode = 5.0:    /usr/bin/codesign_allocate
Xcode > 5.0.1:  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

script approach

bash scriptiong approach
1
2
3
4
5
6
7
8
XCODE_PATH_CONTENT_DEVELOPER=`xcode-select -print-path`
if [ -f "${XCODE_PATH_CONTENT_DEVELOPER}/usr/bin/codesign_allocate" ]; then
  export CODESIGN_ALLOCATE="${XCODE_PATH_CONTENT_DEVELOPER}/usr/bin/codesign_allocate"
elif [ -f "${XCODE_PATH_CONTENT_DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate" ]; then
  export CODESIGN_ALLOCATE="${XCODE_PATH_CONTENT_DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"
else
  export CODESIGN_ALLOCATE="/usr/bin/codesign_allocate"
fi

Comments