How do I put computer to sleep and have it re-awake asking for a password?
I'm looking for a terminal command to do this.
pmset sleepnow did not work.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
There are multiple answers to the question of how to programmatically enable 'Ask for password after sleep or screensaver' -- the option that appears in the Security preferences panel.
Once you've enabled that option, you can use the following command to run an AppleScript to sleep the computer:
osascript -e 'tell application "Finder" to sleep'