nbalonso.com

How to Quickly Lock Your Mac

| Comments

Many Windows users are used to lock their computers with a keyboard combination when they leave their desks, which is a very good practice (not talking about RAM content here, let’s move on!). One thing I’ve got asked a couple of times is how to do the same thing on a Mac, and well the thing is that there are a couple of options to secure your computer when you are away but are not exactly like the Windows.

Because of this I though of writing this article and enumerating  the ways you can accomplish this.

  1. (⌘) + (⌥) + (⏏) : Immediately sleep your Mac.
  2. (⌘) + (⇧) + Q : Then enter to logout gracefully
  3. Close the lid of you laptop. D’oh!
  4. System Preferences -> Mission Control -> Hot Corners… -> Start Screen Saver
  5. /Applications/Utilities/Keychain Access.app -> Preferences -> Show keychain status in menu bar -> Click -> Lock Screen
  6. And finally the last method I learned recently with the help of Greg Neagle:
    • Open Automator and create a new Service; A services that receives no input in any application.
    • System Preferences -> Keyboard -> Shortcuts -> Services; Scroll to the bottom, click on add shortcut for your new service and press your desired key combination.

Here the code portion

1
2
3
4
5
try
  tell application "Finder" to if exists file "CGSession" of folder "Resources" of folder "Contents" of document file "User.menu" of folder "Menu Extras" of folder "CoreServices" of folder "Library" of folder "System" of startup disk then
      do shell script "/System/Library/CoreServices/Menu\\ Extras/User.menu/Contents/Resources/CGSession -suspend"
  end if
end try

Comments