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!!!

Yucky

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 pam_tid.so
Enter fullscreen mode Exit fullscreen mode

Extra

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 🖖

beer

Top comments (13)

Collapse
 
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 com.apple.security.authorization ignoreArd -bool TRUE

source: apple.stackexchange.com/questions/...

Collapse
 
elvis2 profile image
Elvis McNeely

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

Collapse
 
thediego profile image
Diego

Awesome. Works!

Collapse
 
tterb profile image
Brett Stevenson

This is great! Just what I was looking for!

Collapse
 
phantomfactotum profile image
phantomfactotum

Bless your soul

Collapse
 
ben profile image
Ben Halpern

Really slick UX here

Collapse
 
miketineo_95 profile image
Miguel Tineo

Just perfect! 👏

Collapse
 
andresreyesdev profile image
Andrés Reyes Galgani

Gracias amigo y ¡¡Viva Colombia!!

Saludos desde Chile 🇨🇱

Collapse
 
equiman profile image
Camilo Martinez

Con gusto Andrés!

Collapse
 
moatazelmasry2 profile image
Moataz Elmasry

Many thanks. Works great!!!

Collapse
 
gabrielbb profile image
Gabriel Basilio Brito

Works like a charm

Collapse
 
sethusenthil profile image
Sethu Senthil

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

Collapse
 
equiman profile image
Camilo Martinez

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

{
    "terminal.external.osxExec": "iTerm.app",
    "terminal.integrated.fontFamily": "MesloLGS NF",
    "terminal.integrated.fontSize": 14,
    "terminal.integrated.shell.osx": "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!