#include <CoreFoundation/CoreFoundation.h>
#include <Carbon/Carbon.h>
int main(int argc, const char * argv[])
{
//this should be called as root
CFStringRef pathToExecutable = CFStringCreateWithCString(NULL, argv[1], kCFStringEncodingASCII);
CFShow(pathToExecutable);
AXError error = kAXErrorSuccess;
if((error = AXMakeProcessTrusted(pathToExecutable)) != kAXErrorSuccess) {
printf("Error: AXMakeProcessTrusted. AXError code %d\n", error);
CFRelease(pathToExecutable);
return 1;
} else {
printf("Success: the Application has been made trusted\n");
CFRelease(pathToExecutable);
return 0;
}
return 0;
}