Self-distributed application upgrade failed in macOS Ventura(13.2.1) but succeed in macOS 10.x-12.x
- I have built a self-distributing application that notarized Apple. The application has the below self-upgrading logic in the dependency console application:
- (1) Terminate the main-application
- (2) Use NSTask to attach the downloaded dmg file with "-nobrowse" and "-mountpoint" param specified
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/usr/bin/hdiutil"];
[task setArguments:@[@"attach", nerVerionDmgFilePath, @"-nobrowse", @"-mountpoint", mountPoint]];
if ([task terminationStatus] == 0) {
// do left work
}
- (3) Use NSTask to execute removing old version app file and copy new version app file in the "mountPoint" path to "/Application/", reopen the new version app and detach the dmg file, below is the command:
// remove the attributes
NSString *removeFlag = [NSString stringWithFormat:@"/usr/bin/xattr -d -r com.apple.quarantine %@", currentRuningAppPath];
NSString *replaceScript = [NSString stringWithFormat:@"rm -rf %@ && cp -r %@ %@ && %@; /usr/bin/open %@; /usr/bin/hdiutil detach %@ &", currentRuningAppPath, newVersionAppPath, currentRuningAppPath, removeFlag, currentRuningAppPath,mountPoint];
- Above works fine in macOS 10x~12.x, but in macOS Ventura(13.2.1), the system tip my application is broken and which confused me is that "Security" tip my application cames from an unidentified developer but my application is already notarized by Apple. Below is the screenshot of "/usr/bin/open /Application/MyApplication.app" and Security tip.
-
- Does macOS Ventura GateKeeper strengthen the application security detection? What should I do to remove the tip? I tried to fix but not work, have no ideas what the problem is. Really hope to get your help :)!
- ps:
- The upgrading logic works fine in Catlina 、BigSur and Monterey
- I could manually finish the upgrading with the downloaded dmg file, the dmg file is not broken, and the application could open normally.
- ps:
MacBook Pro 16″