How to use sudo with Touch ID on your Mac

Here's a tip from Cabel Sasser of Panic for those of you out there with Touch Bar MacBook Pros who use Terminal and the "sudo" command frequently.

See more

Here's the full step-by-step, for those who want to experiment. That said: sudo is an incredibly powerful command in the Terminal; we don't recommend messing around with this trick if you don't feel comfortable working in the Terminal app and changing system preference files.

Want to learn Terminal? Here are 15 commands we think every user should know.

Also worth noting, via Sasser:

See more

How to enable Touch ID for sudo commands on your MacBook Pro with Touch Bar

  1. In Safari, paste the following into the search bar: file:///etc/pam.d/sudo.Alternatively, you can edit the file within the Terminal app itself using command-line text editors like emacs or nano; if you choose to do this, go to step 8, and skip steps 10-12.
  2. Press Command-I with the sudo file highlighted to open up the information screen.

  1. Click on the Lock icon in the bottom right corner.
  2. Enter your authentication information (or use Touch ID).
  3. Change the privileges of all users to Read & Write.

  1. Download TextWrangler, a free plain text editor, or use the plain text editor of your choice.
  2. Open the sudo file in TextWrangler (or equivalent).
  3. Paste auth sufficient pam_tid.so on line 2 of the document (underneath the initial comment line)Note: If you get a note about the document being locked, go back to step 2-5 and make sure you've enabled Read & Write privileges on the document.
  4. Save the sudo file and close it.

  1. In Finder, press Command-I with the sudo file highlighted to open up the information screen.
  2. Change the privileges on all users to Read only.
  3. Click on the Lock icon in the bottom right corner.

Now, when you open Terminal and attempt a sudo command, you should be prompted with a Touch ID authentication in lieu of entering your administrator password.

Questions?

Let us know below.

Serenity Caldwell

Serenity was formerly the Managing Editor at iMore, and now works for Apple. She's been talking, writing about, and tinkering with Apple products since she was old enough to double-click. In her spare time, she sketches, sings, and in her secret superhero life, plays roller derby. Follow her on Twitter @settern.