Error 1: "Error signing data"
$ productsign --sign 'Developer ID Application: YourCompany' from.pkg to.pkg productsign: signing product with identity "Developer ID Application: YourCompany" from keychain /Users/user/Library/Keychains/login.keychain Error signing data. productsign: error: Failed to sign the product.Reason: keychain is locked for access from SSH. Try
security unlock-keychain -pYou might also need to enable access to certificate private key for all applications:
Error 2: "MyApp.app: object file format unrecognized, invalid, or unsuitable"One solution that worked for me:
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"but it didn't work for other .app package I was trying.