Use secure keyboard entry in Terminal
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.
Choose Terminal > Secure Keyboard Entry.
A checkmark next to Secure Keyboard Entry in the menu lets you know it’s turned on.