Quick Links

Locking your Mac is the best way to secure your computer when you have to step away from it. This won't quit or interrupt any running applications, and you must type your password to get past the lock screen. Here are eight ways to lock your Mac.

First, Require a Password to Unlock Your Mac

There are many ways to lock your Mac. Some of these methods involve actually putting your Mac to sleep. However, this does little to protect your Mac if a password isn't required to access it again. For maximum security, we recommend you always require a password after putting your Mac in sleep mode.

To password protect your Mac after it's been put in sleep mode, click the Apple icon at the top left, and then select "System Preferences."

System Preferences

Here, click "Security & Privacy."

Security and privacy

In the "General" tab, select the checkbox next to "Require Password."

Require password

Type your password, and then click the arrows next to "Require Password" to open the drop-down menu. You can then select the amount of time that must pass before a password is required again. Select "Immediately" to lock your Mac whenever you put it to sleep.

If this isn't enabled, anyone can access your Mac.

Immediately lock Mac after sleep

How to Lock Your Mac

When it comes to cybersecurity, you are the first layer of defense. It doesn't matter which of the following methods you choose to lock your Mac, as long as you choose one. As we'll cover later, make sure you also configure your Mac to automatically lock itself in case you forget.

Close Your Mac's Lid

The simplest way to lock your Mac is to simply close the lid. When you open it again, you'll have to type your password to access the computer and its data.

Use the Keyboard Shortcut

The runner up for the simplest way to lock your Mac is via the keyboard shortcut. You can just press Command+Control+Q to lock your Mac.

Related: The Best macOS Keyboard Shortcuts You Should Be Using

You can also press Command+Shift+Q, but this completely logs you out, which means any applications you were running will also close.

Lock Your Mac from the Apple Menu

You can also easily lock your Mac from the Apple menu. To do so, just click the Apple icon at the top left, and then select "Lock Screen."

Lock screen from apple menu

If you require a password to unlock your Mac immediately after it's put in sleep mode as we covered earlier, you can just click "Sleep" in this same menu.

Put Mac to Sleep from Apple menu

Lock Your Mac Using Hot Corners

Hot Corners is a feature that allows you to touch a corner of your computer's screen with your mouse cursor to activate a command. You can also use this feature to lock your Mac.

First, click the Apple icon at the top left, and then select "System Preferences."

System Preferences

Click "Mission Control."

Mission control in system preferences

At the bottom left, click "Hot Corners."

Hot corners button in mission control

From here, choose the corner you want to use to activate the Lock Screen.

Active screen corners menu

Click the corner in the box to which you want to set the Hot Corner, and then select "Lock Screen."

Lock Screen hot corner

Again, if you require a password to unlock your Mac immediately after it's put in sleep mode, you can just click "Put Display to Sleep" in this same menu.

Put display to sleep hot corner

Click "OK" to set the new Hot Corner command. To activate it, just position your mouse in the corner of the screen you selected.

Lock Your Mac Using Terminal

If you want to feel like a hacker, you can lock your Mac via the Terminal. To launch Terminal, press Command+Space to open Spotlight Search, search for "Terminal," and then click it in the search results.

terminal app in spotlight search

In Terminal, type the following command, and then press Enter:

pmset displaysleepnow

sleep terminal command

Your Mac will now be put in sleep mode. Again, make sure a password is required after it's awakened from sleep mode.

Related: How to Shut Down Your Mac Using Terminal

Lock Your Mac Using the Touch Bar

You can also add a button to the Touch bar of your MacBook Pro to lock it. To do so, click the Apple icon at the top left, and then select "System Preferences."

System Preferences

Click "Keyboard."

keyboard option

At the bottom right, click "Customize Control Strip."

Customize control strip

A menu with several buttons will appear. Click and drag the "Screen Lock" or "Sleep" button down to the Touch bar.

Screen lock and sleep buttons

Now, whenever you tap that button on the Touch bar, it will lock your Mac.

Related: How to Add Custom Buttons to the MacBook Pro Touch Bar

Lock Your Screen from the Menu Bar

If you're using a macOS version that predates Mojave, you can add an option to the menu bar that will put your Mac to sleep. To do so, head over to Applications > Utilities > Keychain Access.

Next, click "Keychain Access," and then select "Preferences."

keychain access preferences

Here, select the checkbox next to the "Show Keychain Status in Menu Bar" option.

keychain access menubar

A lock icon will now appear on the right side of the menu bar; click it, and then select "Lock Screen" from the menu that appears.

keychain access lock screen button

Set Your Mac to Lock Automatically

You should never leave your Mac if it's unlocked, but we all make mistakes. If you do step away from your Mac and forget to lock it, you can set it to lock automatically after it's been idle for a certain amount of time.

To do this, click the Apple icon at the top left, and then select "System Preferences."

System Preferences

If you're running macOS Big Sur or newer, click "Battery."

Battery option

If you're running macOS Catalina or earlier, click "Energy Saver."

Energy saver

Under the "Battery" tab in "Energy Saver," click and drag the slider next to "Turn Display Off After" to the amount of time you prefer. You can set it anywhere from "1 minute" to "Never."

Battery tab

Be sure to do the same under the "Power Adapter" tab.

Power Adapter tab

Note that if you're running macOS Big Sur, the "Battery" and "Power Adapter" tabs will be in the pane on the left.

Power Adapter tab

Now, if you ever forget to lock your Mac before stepping away, it will automatically lock after the amount of time you selected, whether it's plugged in or running on battery power.

Related: 10 Ways to Lock Your Windows 10 PC