1 打開mac中的Automator程序
截屏2020-08-16 上午10.54.57.png
2 創(chuàng)建一個“應用程序”
截屏2020-08-16 上午10.55.30.png
3 點擊“運行AppleScript”這個action罕模,拖動到右側面板
sudoautomator01.png
4 輸入運行sudo的命令穿肄,比如
do shell script "sudo whatevercommandyouwanttorun" with administrator privileges
如果你要運行一個腳本,運行:
do shell script "sudo /path/to/youractualscript.sh" with administrator privileges
sudoautomator02.png
5 保存這個“應用程序”
sudoautomator04.png
6 嘗試打開這個應用程序因悲,測試他的可用性歼争。這時應該會提醒你輸入密碼,因為你執(zhí)行了sudo
命令萧锉。
7 在系統(tǒng)偏好設置------用戶與群組------登錄項中践美,添加剛保存的application