I wrote a small command script for changing file permissions in Terminal, but the user that runs the script needs to type in the password of the computer. This happens in the Terminal window itself.

Is it possible to extend this so it gets a popup box where you enter your computer username and password?

This would make the process look cleaner for people that are not into programming.

1 Answer 1


You can use AppleScript to perform a sudo with a GUI.

do shell script "…" with administrator privileges

In ‘…’ insert a command to be executed as sudo, for example a path to your script.

To run this from Terminal, you can use osascript.

osascript -e 'do shell script "…" with administrator privileges'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .