Authenticate sudo with TouchID on a MacBook Pro

If you own a Mac equipped with a touch bar and you use the command line and sudo often, you can enable the TouchID of your Mac to authenticate yourself.

Open the terminal app:

sudo vi /etc/pam.d/sudo

Now add the line

auth sufficient

directly as the first line after the comment.

I looks now like this:

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

The next time you use sudo, you will be prompted to use your fingerprint to authenticate.