If you’re wondering how to run sudo (for privilege escalation) commands in Automator, this is one way to do it.
Launch up Automator (of course).
Find Run AppleScript in the library of actions.
Then, drag it over to the workflow area on the right. By default, Automator will put in some script structure for you to work with. Feel free to just delete that all completely.
In place of the predefined script, put in
if it’s one command you want to run.
If you would rather run a script, it’s a similar syntax of
You can save your workflow as an application.
When you double-click your .app file, it should then prompt you for an administrator username and password and then run your bash command or shell script in a sudo-like way.
Leave a Reply