CODE:
- (void)installHelperTool;
{
OSStatus status = AuthorizationCreate(...);
// handle errors
NSLog(@"existing: %@", [self system:@"/usr/bin/otool -P "
"/Library/PrivilegedHelperTools/com.GemTalk.GemStone.Helper | "
"grep -A 1 VersionString | tail -1"]);
NSLog(@"replacement: %@", [self system:@"/usr/bin/otool -P "
"GemStone.app/Contents/Library/LaunchServices/com.GemTalk.GemStone.Helper | "
"grep -A 1 VersionString | tail -1"]);
CFErrorRef cfError = nil;
if (SMJobBless(kSMDomainSystemLaunchd, (__bridge CFStringRef)@kHelperIdentifier, authRef, &cfError)) {
NSLog(@"SMJobBless(%s,...) returned true; attempting (%s).", kHelperIdentifier, kShortVersionString);
NSLog(@"now found: %@", [self system:@"/usr/bin/otool -P "
"/Library/PrivilegedHelperTools/com.GemTalk.GemStone.Helper | "
"grep -A 1 VersionString | tail -1"]);
} else {
AppError(@"Helper tool installation failed: %@", [(__bridge NSError*) cfError localizedDescription]);
}
}
CONSOLE:
default 14:25:04.368568 -0800 authd Succeeded authorizing right 'com.apple.ServiceManagement.blesshelper' by client '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' [5626] for authorization created by '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' [5626] (13,0)
default 14:25:04.889238 -0800 kernel AMFI: allowing exception handler for 'GemStone' (5626) because the process is not restricted.
default 14:25:04.385444 -0800 GemStone existing: <string>1.3.3.9</string>
default 14:25:04.900905 -0800 kernel AMFI: allowing exception handler for 'GemStone' (5626) because the process is not restricted.
default 14:25:04.397113 -0800 GemStone replacement: <string>1.4.0</string>
default 14:25:04.398426 -0800 authd Succeeded authorizing right 'com.apple.ServiceManagement.blesshelper' by client '/usr/libexec/smd' [251] for authorization created by '/Users/jfoster/Library/Developer/Xcode/DerivedData/GemStone-akfvfyaoddyaavgbcxnrdhnovoal/Build/Products/Debug/GemStone.app' [5626] (3,0)
default 14:25:04.408694 -0800 GemStone SMJobBless(com.GemTalk.GemStone.Helper,...) returned true; attempting (1.4.0).
default 14:25:04.923798 -0800 kernel AMFI: allowing exception handler for 'GemStone' (5626) because the process is not restricted.
default 14:25:04.419988 -0800 GemStone now found: <string>1.3.3.9</string>