In my case, a shell script is unavoidable (post-install script in an Mac Installer .pkg).
However, copying the .app bundle completely (using cp -R) seems to work fine --- only if USER then double-clicks the app to open it.
If however, another app will use NSWorkspace API to try and launch it, I get an error dialog saying the app is corrupt - and the NSError says it couldn't find a binary to run!!!
` NSWorkspace *ws = [NSWorkspace sharedWorkspace];
NSWorkspaceOpenConfiguration *conf = [NSWorkspaceOpenConfiguration configuration];
conf.addsToRecentItems = NO;
conf.activates = NO;
conf.hides = NO;
conf.appleEvent = appleEvent;
NSURL *appURL = [ws URLForApplicationWithBundleIdentifier:appBundleID];
[ws openApplicationAtURL:appURL configuration:conf completionHandler:^(NSRunningApplication * _Nullable app, NSError * _Nullable error) {
if (error!= nil)
NSLog(@"Failed to launch app UI %@, error:%@", appBundleID, error);
else
NSLog(@"Launched app %@ in the background.", appBundleID);
}];
`
Maybe an AppleScript will "install" it better? the app isn't installed in /Applications, but rather in a private place, and is a menu-bar "status item" app