otool will display sections, but it won’t modify the binary.
strip -no_uuid strips the UUID section, and strip -c creates a stub library by stripping the code signature and all section (code) contents. But it can't strip LC_CODE_SIGNATURE sections without stripping all the code as well.
There's no documented Apple tool to strip code signatures.
But the codesign tool itself has an undocumented option to remove signatures:
codesign has several operations and options that are purposely left
undocumented in this manual page because they are either experimental
(and subject to change at any time), or unadvised to the unwary. The
interminably curious are referred to the published source code.
$ codesign --remove-signature /.../TestSignature.app/Contents/MacOS/TestSignature
/.../TestSignature.app/Contents/MacOS/TestSignature: unsupported type or version of signature
$ codesign --remove-signature /.../TestSignature.app
/.../TestSignature.app: unsupported type or version of signature
$ codesign --remove-signature /.../TestSignature.app/Contents/_CodeSignature/CodeResources
(Prints nothing, leaves CodeResources unchanged.)
TestSignature is the OS X Objective C app template signed by "-" (local, default identity).
I wonder if it only strips v1 signatures, and hasn't been updated for v2 signatures?
(I'm on 10.10.5 with Xcode 7.1, perhaps other versions of codesign will work.)
I've been working off this Apple code signing documentation:
Mozilla has solved a related problem by adding striptease (an enhanced strip command) to their build process:
striptease will strip code signatures, but it's an external tool, so that's not an ideal dependency.
Tim
Tim Wilson-Brown (teor)
teor2345 at gmail dot com
PGP 968F094B
teor at blah dot im
OTR CAD08081 9755866D 89E2A06F E3558B7F B5A9D14F