Code Signing Error : object file format unrecognized, invalid, or unsuitable

August 2, 2012

I recently upgraded to Mac OS X Mountain Lion, which for the most part has been a good experience. However, code signing of applications from a terminal window began to generate an error:

object file format unrecognized, invalid, or unsuitable

I found that setting the CODESIGN_ALLOCATE environment variable as follows, before calling the codesign application, will take care of the issue:

export CODESIGN_ALLOCATE="/Applications/"

I added the above in the bash shell script that I use for application signing. Adding this setting in the .bash_profile file would also be an option so the change would be system wide.


Thanks for the tip. I encountered the same problem your solution worked for me.

by Arthur on Sep 6, 2012. Reply #

Well, that at least changed the error message for me.

Used to be:

prompt$ codesign -s “Certificate” -f object file format unrecognized, invalid, or unsuitable

Now it’s:

prompt$ export CODESIGN_ALLOCATE=”/Applications/”

prompt$ codesign -s “Certificate” -f cannot find code object on disk

by Jeremy on Dec 11, 2012. Reply #

Thank you for your post, I spent hours researching this issue. Your recommendation resolved my issue. The majority of solutions mention that the following should resolve, but in my case it did not.
“sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate /usr/bin”

by Adrian on Dec 21, 2012. Reply #

Glad to know if helped!

by John Muchow on Dec 21, 2012. Reply #

Thanks tons, the below line resolved my issue

“sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate /usr/bin”

by Setra on Apr 9, 2013. Reply #

It helped me. Thank you very much John!

by gala on Feb 5, 2013. Reply #

Leave a Comment