1 year ago

#300477

test-img

cHorse1981

Execute sudo command from swift

I am writing a sandboxed MacOS app in swift and I need to run a few command line commands. For most of the commands this isn't an issue. There's plenty of examples of how to execute that type of command. Where I'm having difficulty is running a command that requires sudo. Hard coding the password isn't an option because I have no way of knowing the user's password. I've looked into running it with AppleScript with administrator privileges but the user is never prompted for their credentials. If possible I would rather they not be prompted ever time I run the sudo command.

swift

macos

command-line

sudo

0 Answers

Your Answer

Accepted video resources