How to use Sudo with Touch ID

If you have MacBook Pro with Touch Bar, you can improve your experience of the command line. You can enable Touch ID to authenticate sudo.

Open the file /etc/pam.d/sudo:

sudo vi /etc/pam.d/sudo

Then add the following line.

auth       sufficient

Your /etc/pam.d/sudo should now like this:

# sudo: auth account password session
auth       sufficient
auth       sufficient
auth       required
account    required
password   required
session    required

If you use sudo now, you will be asked for your fingerprint.