If you are a web developer or a power user on a Mac, you likely spend a lot of time in the Terminal. Whenever you type a command that requires administrative privileges (using the sudo prefix), the Terminal pauses and demands that you physically type out your entire Mac login password on the keyboard.
Your MacBook Pro has a highly advanced Touch ID fingerprint scanner built right into the keyboard. You use it to unlock your Mac, pay for apps, and autofill passwords in Safari. Yet, the Terminal stubbornly forces you to type. You can bypass this archaic text-based authentication and force the Terminal to accept your fingerprint by modifying the core sudo configuration file.
How to Safely Bypass the Mac Terminal Password Prompt
You must edit the `sudoers` PAM (Pluggable Authentication Module) configuration in the terminal.
Warning: Editing this file incorrectly can break your ability to use the sudo command. Follow these instructions exactly.
- Open the Finder, go to Applications, open the Utilities folder, and double-click Terminal.
- We will use the nano text editor to modify the file safely. Type this command and press Enter:
sudo nano /etc/pam.d/sudo - The terminal will demand your password one last time. Type it (the characters remain invisible) and press Enter.
- The editor will open, showing a few lines of configuration text. You must insert a brand new line at the very top, immediately underneath the line that says
# sudo: auth account password session. - Use your arrow keys to move the cursor to the start of the second line, press Enter to create a blank line, and move the cursor up to that blank space.
- Carefully type this exact text:
auth sufficient pam_tid.so - Press Ctrl + O to save the file, press Enter to confirm, and then press Ctrl + X to exit nano.
Close your Terminal window completely and reopen it. Type any sudo command (like sudo ls) and press Enter. Instantly, a macOS graphical prompt will pop up in the center of your screen asking for Touch ID. Rest your finger on the sensor, and the terminal will instantly authenticate and execute the command, permanently bypassing the need to ever type your password again.