3

The following command causes an immediate system sleep

pmset sleepnow

Trying to shutdown system with pmset

$ pmset shutdown
Usage: pmset <options>
See pmset(1) for details: 'man pmset'

Experiment with shutdown command

$ shutdown -h now
shutdown: NOT super-user
$ sudo shutdown -h now
Password:

So each time to shutdown system, I should enter a password to use the superuser.

Could it be possible to shut down with ‘pmset’?

5

Using pmset or any system tools to perform shutdown requires sudo.

You can ask macOS to shut down from the user's account by telling System Events using AppleScript. You can run AppleScript from the command line by using osascript.

osascript -e 'tell app "System Events" to shut down'

This will fail if another user is logged in since this always requires authentication, matching what occurs if the user chooses Shut Down from the Apple menu.

For commands to perform other power-related actions, see

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .