We use the appscript gem for an Mac App we developed. To install appscript we ask for the Admin password and then we use a custom script to install every file we need. The objc method that calls the Sudo Dialog when files are missing is printer below. Their should be a ruby way to do this. I attached a shell script that installs the appscript gems and the sqlite gems.
It works great for us.
// checkAppScript checks if the appscript binary are installed. If not it tries to install
- (void) checkAppScript
{
NSLog(@"Authorization Start");
NSFileManager *fileManager = [[NSFileManager alloc] init];
if(![fileManager fileExistsAtPath:@"/Library/Ruby/Site/1.8/universal-darwin11.0/ae.bundle"]){
AuthorizationRef authorizationRef;
OSStatus status;
status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,kAuthorizationFlagDefaults, &authorizationRef);
NSString* installAppScriptScriptTmp = [railsRootDir stringByAppendingString:@"/lib/refxPrerequisitesInstall.sh"];
const char *installTool = [installAppScriptScriptTmp UTF8String];
char *tool_args[] = {};
//[installAppScriptScriptTmp release];
status = AuthorizationExecuteWithPrivileges(authorizationRef, installTool,kAuthorizationFlagDefaults, tool_args, NULL);
NSLog(@"Authorization Result Code: %d", status);
// Check for status TODO
}
[fileManager release];
}