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


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

Easy Peasy Japanesey

Restart and enjoy it.

That's All Folks!
Happy Coding 🖖


Top comments (13)

kychanbi profile image
kychanbi • Edited on

There is an extra step needed for some guys using display docks.
I followed the above steps, but got GUI password prompt instead of touchID

After I ran this. It works prefect now.
defaults write ignoreArd -bool TRUE


elvis2 profile image
Elvis McNeely

Thanks! After applying this (and the instructions from the author) I started to get the biometric password prompt.

thediego profile image

Awesome. Works!

tterb profile image
Brett Stevenson

This is great! Just what I was looking for!

phantomfactotum profile image

Bless your soul

ben profile image
Ben Halpern

Really slick UX here

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

Con gusto Andrés!

moatazelmasry2 profile image
Moataz Elmasry

Many thanks. Works great!!!

gabrielbb profile image
Gabriel Basilio Brito

Works like a charm

sethusenthil profile image
Sethu Senthil

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

equiman profile image
Camilo Martinez

I used to have this configuration, and also works on VS Code.

    "terminal.external.osxExec": "",
    "terminal.integrated.fontFamily": "MesloLGS NF",
    "terminal.integrated.fontSize": 14,
    "": "zsh",
    "terminal.integrated.shellIntegration.enabled": true,
Enter fullscreen mode Exit fullscreen mode

Hey 😍

Want to help the DEV Community feel more like a community?

Head over to the Welcome Thread and greet some new community members!

It only takes a minute of your time, and goes a long way!