I use applescript to launch my script with root privileges.
osascript -e "do shell script \"myscript.sh\" with administrator privileges"
This text is displayed in the prompt:
osascript wants to make changes.
Type your password to allow this.
How can I change the name "osascript" to my executables name? Is there a way to change the icon in this prompt?
In the Script Editor app on your Mac, click the Run button in the toolbar, or press Command-R, to execute the commands in your script.
Click Actions in the top-left corner of the Automator window, then select Utilities in the Library. Drag the Run AppleScript action into your workflow. You can edit, compile, and test your script right in the action, or you can develop your script in Script Editor.
If you make your AppleScript an application (in Script Editor, go File>Save as…>Type "Application"), you can then set an icon and a user-friendly name. Save the application with the name that you want to appear in the alert window (replacing "osascript). Set an icon by opening the new application's package, and replacing the applet.icns file with your own icon.
If you need to call this from the command line, then you can use the open
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With