How to Lock Your Mac via Terminal

Securing your Mac quickly can be achieved through Terminal commands. Please note that this method only turns off the display, and the actual lock screen with password protection is activated based on your system settings.

Opening Terminal

To initiate the process, open the Terminal application. You can find it by searching in Spotlight or navigating to Applications > Utilities > Terminal.

Executing the Command

Once Terminal is open, enter the following command:

1
pmset displaysleepnow

Press Enter to execute the command.

Display Turns Off

After entering the command, your Mac’s display will turn off, putting it into a sleep state.

0%