install_name_tool vs. codesign

I have a shell script that turns a framework into a plain dylib and updates some dependent library paths using install_name_tool. It works, but if the framework was signed, I get warnings like:

install_name_tool: warning: changes being made to the file will invalidate the code signature in: [redacted].dylib (for architecture x86_64)

I thought I could get rid of the warning by adding

codesign --remove-signature dylib-path

to the script before using install_name_tool, but then I get errors like

install_name_tool: fatal error: file not in an order that can be processed (link edit information does not fill the __LINKEDIT segment): [redacted].dylib (for architecture x86_64)

Is there a way to fix this?

Accepted Reply

There’s a reason why --remove-signature is not in the codesign man page. It’s useful, but it’s not perfect.

If --remove-signature is causing problems, I recommend that you:

  1. Just ignore the warning from install_name_tool.

  2. When you’re done, re-sign the library using codesign with the -f flag.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

There’s a reason why --remove-signature is not in the codesign man page. It’s useful, but it’s not perfect.

If --remove-signature is causing problems, I recommend that you:

  1. Just ignore the warning from install_name_tool.

  2. When you’re done, re-sign the library using codesign with the -f flag.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"