What option should I give the sudo command to have the password asked through a graphical interface?
OS X doesn't have an entirely clean way to do this, but there are a few ways to fake it.  First, AppleScript has a good way to do sudo-ish things based on a graphical authentication, and you can use that: 

osascript -e "do shell script \"stufftorunasroot\" with administrator privileges"


You can also use that mechanism to set the sudo timestamp, and then use the regular sudo (within the 5-minute timeout window) to do things:

osascript -e "do shell script \"mkdir -p /var/db/sudo/$USER; touch /var/db/sudo/$USER\" with administrator privileges" &amp;&amp; \
    sudo stufftorunasroot


Finally, you can use AppleScript to prompt for a password, then pass that to sudo:

pw="$(osascript -e 'Tell application "System Events" to display dialog "Password:" default answer "" with hidden answer' -e 'text returned of result' 2&gt;/dev/null)" &amp;&amp; /
    echo "$pw" | sudo -S stufftorunasroot