Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier

We have an enormous legacy based application which has been ported from Windows. The build system is make and has literally hundreds of .cpp, .c, .h, .m, and .mm files.

I've gotten it successfully running on MacOSX and managed to build nice installation packages using the "Packages" package which have been sucessfully signed, notarized and stapled, and install nicely on "clean" Machines.

The .app/bundle format has been lovingly laid out to match the app.

Now, I'd like to use Testflight to deliver the app, and eventually the Mac App Store.

In my first attempt, I tried xcrun altool --validate-app .. to validate the Packages built app. It, not surprisingly, failed spectacularly because I guess it hasn't kept up with however packages need to be build to pass --validate.

(It's an amazing tool though)

So, I decided to use pkgbuild and productbuild to build the package:

pkgbuild --root App_name.app --identifier com.mycompany.myapp --sign "Developer ID Installer: ...." --scripts Scripts --install-location "/Applications/MyApp.app" Distribution.pkg productbuild --synthesize --package Distribution.pkg Distribution.xml

productbuild --distribution Distribution.xml --sign "Developer ID Installer..." --package-path . MyApp.productbuild.pkg xcrun altool --validate-app -f MyApp.productbuild.pkg -u username --type macos This fails with:

 {
    NSLocalizedDescription = "Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in \U2018MyApp.productbuild.pkg\U2019.";
    NSLocalizedFailureReason = "Unable to validate your application.";
}

I confirmed I have an info.plist and if contains a valid CFBundleIdentifier, and I extracted the package using Pacifist and confirmed it's there, too.

I'm at a loss. Converting the package to XCode would be a monumental effort right now, and I'd really like to avoid it.

Is there something I'm missing, or should this work?

Thanks!

this looks a little odd to me:

"Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in \U2018MyApp.productbuild.pkg\U2019.";

because it is presenting the name of the package inside quoted Unicode LEFT SINGLE QUOTATION MARK and RIGHT SINGLE QUOTATION MARK. I'd expect plain quotation marks.

Take a careful look at the contents of your scripts and make sure you're not copying a command line from a text editor (such as Word) that likes to convert written ' and " to curly quotes.

I fixed it! I read https://developer.apple.com/documentation/xcode/packaging-mac-software-for-distribution more carefully and this is the command that worked:

productbuild --sign "3rd Party Mac Developer Installer: ..." --scripts scripts --component MyApp.app /Applications MyAppInstaller.pkg

Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier
 
 
Q