Mac applescript - ask for administrator privileges

I am using applescript to run a script with root privileges.

osascript -e "do shell script \"myscript.sh\" with administrator privileges" 

This text is displayed on the command line:

 osascript wants to make changes. Type your password to allow this. 

How do I change the name "osascript" to my executable file name? Is there a way to change the icon in this prompt?

+6
source share
1 answer

If you are creating an AppleScript application (in the Script editor, go to File> Save As ...> Enter "Application"), you can set the icon and a convenient name. Save the application with the name that you want to display in the warning window (replace "osascript"). Install the icon by opening a new application package and replacing the applet.icns file with your own icon.

If you need to call this from the command line, you can use the open command.

+4
source

Source: https://habr.com/ru/post/971281/


All Articles