How can I run a script or app as sudo with a click?
Run sudo visudo (or EDITOR=nano sudo visudo) and add a line like this:

%admin ALL=NOPASSWD: /usr/bin/myscript


Then create a .command file that runs /usr/bin/myscript:

echo sudo myscript&gt;~/Desktop/test.command
chmod +x ~/Desktop/test.command
echo $'#!/bin/sh\nls /var/root'|sudo tee /usr/bin/myscript;sudo chmod +x /usr/bin/myscript


Or if for example you want to run sudo purge without having to enter a password, add

 %admin ALL=NOPASSWD: /usr/sbin/purge


to sudoers.