MacOS – How to fix this CODESIGNING error

bashmacosterminal

After having successfully compiled bash and sh for OS X Mavericks our OS X Server's System Log is flooded every 2 or 3 seconds with:

... kernel[0]: CODESIGNING: rejected new signature for architecture 16777223 of file /bin/sh
... kernel[0]: proc 59029: load code signature error 4 for file "sh"

There are no complaints about bash, only sh.

What is going on and what can I do to fix it?

Best Answer

I have observed the same error when deploying my own signed apps. It appears that if you mv/cp a new binary over an existing signed one, the kernel does not keep track of this very well and starts generating these errors. I have found that this does not occur if the new binary is installed as part of a package, or if the original binary is deleted first and then the new binary put in place. Additionally once in this situation, a reboot fixes the issue, presumably as the kernel codesigning table is stored in memory. I appreciate rebooting may not be an option in a server environment.