Skip to content

Instantly share code, notes, and snippets.

@pich4ya
Created March 20, 2021 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pich4ya/6ff60706a8a693929c6ada1f39875a41 to your computer and use it in GitHub Desktop.
Save pich4ya/6ff60706a8a693929c6ada1f39875a41 to your computer and use it in GitHub Desktop.
Automatically enable Macbook Pro's Touch ID for sudo after MacOS version upgrade
# Automatically enable Macbook Pro's Touch ID for sudo after MacOS version upgrade
sudotouchid () {
if ! /usr/bin/grep -Fq "pam_tid.so" /etc/pam.d/sudo
then
# Use Touch ID to enable Touch ID for sudo
/usr/bin/osascript -e 'do shell script "/usr/bin/sed -i '' -e \"1s/^//p; 1s/^.*/auth sufficient pam_tid.so/\" /etc/pam.d/sudo" with administrator privileges'
fi
}
sudotouchid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment