DEV Community

Cover image for How to use MacOS's Touch ID on Terminal
Camilo Martinez
Camilo Martinez

Posted on • Updated on

How to use MacOS's Touch ID on Terminal

I know... use a fingerprint scanner and never come back. No need to write passwords, pins or patterns. But on the terminal when we use the magic word sudo ask for your password... yuck!!!


Don't worry. It can be solved easily. Edit this file /etc/pam.d/sudo with your favorite editor. Mine is the VS Code because can deal with admin permission. Run this command on a terminal.

code /etc/pam.d/sudo
Enter fullscreen mode Exit fullscreen mode

Add the following line on top

auth sufficient
Enter fullscreen mode Exit fullscreen mode

Easy Peasy Japanesey


On default terminal works like a charm, but on iTerm2 need an extra configuration. Go to Prefs -> Advanced -> Allow sessions to survive logging out and back in and set value to no.

Easy Peasy Japanesey

Restart and enjoy it.

That's All Folks!
Happy Coding đź––

Buy me a cofee

Discussion (9)

ben profile image
Ben Halpern

Really slick UX here

gabrielbb profile image
Gabriel Basilio Brito

Works like a charm

miketineo_95 profile image
Miguel Tineo

Just perfect! đź‘Ź

andresreyesdev profile image
Andrés Reyes Galgani

Gracias amigo y ¡¡Viva Colombia!!

Saludos desde Chile 🇨🇱

equiman profile image
Camilo Martinez Author

Con gusto Andrés!

moatazelmasry2 profile image
Moataz Elmasry

Many thanks. Works great!!!

tterb profile image
Brett Stevenson

This is great! Just what I was looking for!

phantomfactotum profile image

Bless your soul

sethusenthil profile image
Sethu Senthil

Is there a way to make this work on the VS Code integrated terminal?