How to sign a Mac OS X application in Linux?

后端 未结 3 1902
广开言路
广开言路 2021-02-19 05:10

For OS X, I distribute my Java application inside a DMG. Since Mountain Lion\'s release, opening the app gives the following error message:

[app name] is

3条回答
  •  没有蜡笔的小新
    2021-02-19 05:34

    You could workaround this by only signing the JavaApplicationStub and info.plist of your application and exclude the "Resources" folder from signing. Then you'd have to change your build process to use the pre-signed container. Of course this is not the sense of codesigning but it will work ;-)

    To achieve this, do the following steps:

    • create your .app as usual
    • move it to your mac
    • create a file "ResourceRules.plist" with the following contents:

    ResourceRules.plist:

    
    
    
    
            rules
            
                    ^Resources/
                    
                    ^version.plist$
                    
            
    
    
    
    • now sign with the following commands: CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate" codesign -s "Certificate Name" --resource-rules ResourceRules.plist -fv MyApp.app

    • Then delete everything in Resource and verify the signature (codesign -v -v MyApp.app). You will see that it's still valid

    • Use the complete signed stub in your build process. You can change everything in Resources but you cannot change info.plist.

提交回复
热议问题