Use secure keyboard entry in Terminal on Mac
Secure keyboard entry can prevent other apps on your computer or the network from detecting and recording what you type in Terminal.
Before you turn on secure keyboard entry, make sure other apps don’t require keystrokes from Terminal.
In the Terminal app on your Mac, choose Terminal > Secure Keyboard Entry.
A checkmark next to Secure Keyboard Entry in the menu lets you know it’s turned on.