Extract and run binary out of .app

We have a huge project.

Until today we didn't use an .app but now we must in order to use Endpoint security and other stuff.

Until today our binary sat in /opt/XYZ/binary.bin

Now because of the .app, looks like it will have to be /opt/XYZ/Cool.app/Content/MacOs/binary.bin

This change really breaks our code and will cause a massive code change.

If I extract the binary from the app and place it in /opt/XYZ/binary.bin and run it, the process is killed.

Is there a way to extract it from the app and run it from /opt/XYZ ? any tool, command, resource, etc' will be great.

Replies

/opt/XYZ/Cool.app/Content/MacOs/binary.bin

Be careful of the case here. It should be MacOS, not MacOs. The tricky thing is that, because most Macs use a case-insensitive file system, you won’t notice this until some poor user who’s decided to use a case-sensitive file system adopts your product O-:

Is there a way to extract it from the app and run it from /opt/XYZ ?

No. I touch on this in Signing a daemon with a restricted entitlement. Specifically:

  • An ES client must be signed by a restricted entitlement, one that must be authorised by a provisioning profile.

  • Your daemon must be in an app-like wrapper so that the system can locate the provisioning profile that authorises your use of this entitlement.

A common trick here is to replace the original binary with a symlink to the one inside the wrapper.

Share and Enjoy

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