How to use TouchID for sudo in Terminal

On Macs with touchbar it can get annoying typing the password everytime you are trying to call "sudo [command] in Terminal.

There is a way to make the touch id scan window appear whenever you are trying to execute a sudo command:

To make this work, just add a line

auth sufficient pam_tid.so

to the beginning of the /etc/pam.d/sudo file.

The file must be edited by the root user, like so:

sudo nano /etc/pam.d/sudo

After making a change, press Control+w, then Control+x and from now on each time you run sudo, you'll be asked to touchid with an oppotunity to opt out to the regular password by pressing a "Use password" button.

Why Apple hasn't set this enabled in default configuration or at least added a checkbox to the UI in System Preferences?

← Back to Articles