Running shell script with Touch ID authentication
0
votes
1
answer
172
views
Leveraging AppleScript, we can run a shell command that requires
sudo
by asking for elevated permissions, which in turn shows a prompt to the user. For example:
do shell script "/usr/bin/say example" with administrator privileges
Prior to Sonoma, this used to show a Touch ID prompt (on supported Macs) or a password prompt (on Macs without Touch ID). But then it stopped working and it now always shows a password prompt.
Is there a way to get the behaviour back? The requirement is simple: I want to run a script with elevated permissions and show a Touch ID (or password prompt when on an unsupported Mac) to ask for the authentication. The full thing should still return the script's exit code as that is important for error detection.
I'm not married to AppleScript, I'm open to something in Swift which has to be compiled. But it does still need to run an external script.
Asked by user137369
(1666 rep)
Feb 1, 2025, 05:54 PM
Last activity: Feb 1, 2025, 09:34 PM
Last activity: Feb 1, 2025, 09:34 PM