Use Touch ID instead of typing your password for sudo — via Siddhant Khare (GitHub gist)
If you use Terminal a lot, typing your password for every sudo gets old. Since macOS Sonoma, Apple ships a template file that lets sudo accept Touch ID, and it survives system updates (older hacks edited a file that updates overwrote).
Takes effect right away
The easy way
- Run the command. If you don't have an
/etc/pam.d/sudo_localfile yet, it creates one from Apple'ssudo_local.templatewith the Touch ID line (pam_tid.so) switched on. If the file already exists, it stops and tells you, so nothing is overwritten. - Open a new Terminal window and run
sudo lsto test. You should get a Touch ID prompt. - If you prefer to edit by hand:
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local, then open it withsudo nano /etc/pam.d/sudo_localand remove the#before thepam_tid.soline.
Command
Run in Terminal (Applications › Utilities). It uses sudo, so macOS asks for your password.
[ -e /etc/pam.d/sudo_local ] && echo 'sudo_local already exists: edit it by hand instead' || sed -e 's/^#auth/auth/' /etc/pam.d/sudo_local.template | sudo tee /etc/pam.d/sudo_localUndo
sudo sed -i '' 's/^auth\(.*pam_tid\.so\)/#auth\1/' /etc/pam.d/sudo_localNeeds a Mac or keyboard with Touch ID. The undo only comments out thepam_tid.soline again and leaves anything else in the file alone. If this tweak created the file and you never added anything else to it, you can delete it instead withsudo rm /etc/pam.d/sudo_local. Don't edit/etc/pam.d/sudoitself.
Sources
- Enable Touch ID for sudo on macOS Sonoma 14.x — by Siddhant Khare (GitHub gist)
- In macOS Sonoma, Touch ID for sudo can survive updates — by Dan Moren, Six Colors
- Source reviewed
- 2026-11-02
- Link checked
- 2026-11-02
- Tested hands-on
- Not by Oddbyte.Me
Oddbyte.Me hasn't tried this on every macOS version, so keep the undo handy.