Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an App store entitlement for NSAppleScript(source: "do shell script \"sudo" commands?

For example, my app uses the following command with the OS handling a pop up alert to request the admin password to authenticate as root. Is there an entitlement that will allow me run this from within the sandbox ?

    @IBAction func clearFonts(sender: NSButton) {

    NSAppleScript(source: "do shell script \"sudo atsutil databases -remove;sudo atsutil server -shutdown\" with administrator " +
        "privileges")!.executeAndReturnError(nil)

}
like image 931
tsh79 Avatar asked May 10 '26 00:05

tsh79


1 Answers

you can't do that if the app is sandboxed, arbitrary script execution is forbidden by the sandbox. No sudo allowed.

like image 141
mahal tertin Avatar answered May 12 '26 13:05

mahal tertin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!