Codesign fails when main executable is a symlink

We are trying to run codesign on a bundle that has a symlink in place of the executable in the /MacOS folder. Codesign produces an error "the main executable or Info.plist must be a regular file (no symlinks, etc.)."


We have tried replacing the symlink with a copy of the file but this breaks our launcher. We have also tried removing the symlink and changing the CFBundleExecutable value in the info.plist to be the relative path to the file. This fixes the error in codesign but causes Application Loader to fail during verification because it cannot find the executable.


Is there a way to sign a bundle that contains a symlink in place of the main executable? Alternatively is there a way to remove the symlink that still allows the application to launch?

Replies

I very much doubt you’ll be able to get a symlink working here. My recommendation is here that you put your main executable in the right place and then deal with whatever breakage that creates in your launcher.

If you can explain why your launching is having problems I may be able to help you with that.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Our application is written in Java and we are trying to package with a bundled jre. The jre has a symlink in place of the main executable. When I try to replace the symlink with a copy of the file I get this error ""Error: could not find libjava.dylib." The file libjava.dylib is another file in the the jre.


Do you have any ideas as to why replacing the symlink with a copy of the file causes this problem?

Do you have any ideas as to why replacing the symlink with a copy of the file causes this problem?

Not specifically, but that very specific error code is a strong indication that this won’t work.

If you’re building a Java app you should consult the documentation from your Java environment provider on how to package that for the Mac App Store. You’re not the first person to do this, and it would make sense for you to lean on folks with experience doing this than try to solve the problem from first principles.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"