48

In OS X 10.9 and later: pmset displaysleepnow By itself, this command only causes the display to sleep, resulting in a black screen. By configuring your computer to require a password immediately after sleep, this one-liner works as a "lock computer" command. The preference is available at System Preferences > Security & Privacy > General. Source: How ...


40

Note: This solution is unique in that it uses the Keychain Access menu bar status functionality, but it does not require you to enable the Show keychain status in menu bar option as the AppleScript methods do. I was also looking for a solution for this. Today I just had some time to play around and found a way to programmatically actually call the ...


32

I'm using a MacBook Air 2012 with Mountain Lion, and the new keyboard shortcut is: Control+Shift+Power


23

It's because the sleeve has a "Magnetic snap closure with no zippers" which actually mimics the magnetic latch that's triggered while the lid of the MacBook is closed which turns off the screen. I've noticed this happen to me a few times in different situations when I would put my iPhone on the hand rest part of the MacBook or If i left my Adonit Jot Pro(...


16

Edit: pressing the power key on a MacBook Air while holding control and shift does not work in 10.7. The power key can only be substituted for eject in 10.8 and later versions of OS X. Putting displays to sleep only locks the screen if this setting is enabled: You can also put displays to sleep in 10.9 by running pmset displaysleepnow. Another way to lock ...


16

You can set up a hot corner for screen saver, and have the security settings to require your password immediately after the screen saver starts. This means when you go to leave the computer, you just move the mouse to a specified corner of the screen and BAM it's locked. First, you would open System Preferences, and then go to "Desktop & Screen saver". ...


15

I use Alfred → The universal hotkey allows me to activate it using a keyboard.


14

UPDATE: 2019. The Lock Screen for keychain no longer is available in current version of the MacOS Mojave & High Sierra. Apple have now add a Lock Screen Menu item in the Apple menu. This has the default keyboard short cut of crtl + cmd + Q ------------- Old answer for previous OS below -------------- @Bart Arondson answer goes into using some ...


13

Use a keyboard shortcut and use Automator to make a screen lock service. This will allow you to set any keyboard command you would like to lock or start a screen saver on your mac. As referenced below is a nice article on how to do the process. Handy screen locking tips for Mac If mousing to part of the screen isn’t your thing, you can use the keyboard ...


13

I just found that I could lock my screen using the following shortcut: Control ⌃+Shift ⇧+Power ⌽ Require password immediately after sleep or screen saver begins should be checked in the Security & Privacy in System Preferences panel if you want to ensure a slept screen is also securely locked.


13

MacBook Air replaces eject button with power button. Use this instead: Update 2013-11-23: I apologize for not reading the question carefully. I missed the part where you want to actually lock the screen. The combination key below only turn off the screen without actually locking it. Control+Shift+Power/Eject Button If you want to enter sleep mode (where ...


13

Getting information from this answer and this answer: Press the Spotlight button at the top right of the screen (Cmd + Space) Search Keychain Access. Open this Open Preferences (Cmd + ,(comma)) Check Show Status in Menu Bar Press the Spotlight button at the top right of the screen (Cmd + Space) Search Automator. Select this Create new Service Search Run ...


13

KeepingYouAwake is a free and open source app that can be used for this purpose. The intended purpose of this app is to prevent your Mac from going into sleep. You can activate this app from 5/15/30 minutes to 1/2/5 hours to indefinite duration. Having KeepingYouAwake activated will prevent screen from turning off when lock screen mode is activated. ...


11

The easiest way to go about this without jailbreaking is to use some custom wallpaper. Make a new document in Photoshop, Pixelmator, GIMP, or your editor of choice. Find a high-resolution image on the Web that you like and copy it into the document. Crop it to 640 x 960 pixels. Add some text with your personal info over the image. Make sure that you leave ...


11

You can use Guided Access to restrict access to a single app, and even ignore touch on certain (or all) parts of the screen. To enable, first go to Settings > General > Accessibility > Guided Access. Then once you're in the app, just triple tap the home button. See iOS: About Guided Access for more information or check out this short video.


9

This bugged me for a while. I just found out that (on my phone anyway) if you slide your finger from left to right on the name of the caller, you will see your call menu again.


8

Since at the login window (and the lock screen) your user is not logged in, you´ll have to edit the global preferences: sudo defaults write /Library/Preferences/.GlobalPreferences AppleLocale en_GB and: sudo defaults write /var/root/Library/Preferences/.GlobalPreferences AppleLocale en_GB and then do a reboot. This fixed it for me (and I hope, Apple ...


8

Set the preferences to lock the screen when the screen saver is active. Then you can use this terminal command to start the screen saver. /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine As far as I can tell this is exactly what the Keychain menu item does.


8

Here's something for anyone who, like me, scoured the web for a simple Mac equivalent to "Windows-L" to lock the screen, and found that all the solutions either required third-party software you don't want or a special key that doesn't exist on your (generic external) keyboard. The following worked for me in Mavericks (10.9.3) Launch the "Automator" ...


7

TL;DR Launch Terminal and run: ifconfig | grep -B 6 'status: active' | head -n 1 | cut -d : -f 1 Then run (replace en0 below with the output of the command above): cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources sudo ./airport en0 prefs DisconnectOnLogout=NO sudo pmset -a sleep 0 Long version I am on MacOS Mojave (...


7

EDIT: With macOS High Sierra (as of beta 5) you can achieve the same "lock screen" behaviour mentioned by @Phong simply through the  status bar menu: What I think is happening is that your computer goes to sleep after a certain amount of time after you switched to the login window which causes your script to stop. To prevent your system from sleeping ...


6

Found this on another answer but an AppleScript that simply contains the following works for me. tell application "Finder" to sleep


6

Just follow these steps to lock the screen on macOS. In Spotlight (⌘ + Space) search for Keychain Access In Keychain Access, select Preferences... from the first menu (⌘ + ,) Check Show keychain status in menu bar. This will show a lock in your Menu Bar with an option Lock Screen Add a custom shortcut to lock the screen System Preferences > Keyboard &...


6

Yes - the frame buffer should be scrubbed / discarded as part of the sleep / lock process no matter how brief the render. I don't think it's a huge risk and can be mitigated as you say by logging out of the screen before locking or any number of other ways like timed lockouts. I'd just log out or enable fast user switching and switch away from the screen ...


5

You can do this via the command line if you can ssh into the machine, using the screencapture command. Take a look at this question for some more info.


5

It can be enabled via System Preferences > Users & Groups > [Unlock] > Login Options > Show fast user switching menu as...


5

The easiest way to lock your computer is to set require password immediately and turn off the display with the following key combination: control + shift + power I find this super helpful and a great replacement for ctrl + shift + delete in Windows.


5

To lock your screen using a apple keyboard try this Or do this by going to "System Preferences" then "Security" under "General"


5

No, that's not likely without jailbreaking the phone. There are only a limited number of features on the iPhone that an app can interface with. I very much doubt "shutdown" is one of them.


Only top voted, non community-wiki answers of a minimum length are eligible