Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Is there a quick way to lock my Mac?

I am familiar with using Automator, but I do not know what code should be used to accomplish the feature. Can anyone provide the code used to lock my retina MacBook Pro? I want a function similar to the one in Windows when you press Windows+L.

share|improve this question

marked as duplicate by user495470, CajunLuke, daviesgeek, Stu Wilson, patrix Sep 29 '12 at 17:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

What sort of "macbook" you mean matters here, as well as what you mean by "lock" it. What hardware do you have, and what do you hope locking the machine will accomplish? – Daniel Sep 27 '12 at 20:13
up vote 1 down vote accepted

If it helps, on 10.7 Lion, I just use a global two-key shortcut in BetterTouchTool (free/donationware) to start the screen saver and lock my Mac. You'll also need "Require password for sleep and screen saver" set to "immediately" in System Preferences > Security & Privacy > General. The shortcut shown here is + L which I prefer to other solutions as its virtually the same key positions for my Windows and Mac machines!

enter image description here

Alternatively, you can also use Ctrl + + / (eject key, or power key on Macbook Air) to put the display to sleep immediately (this also requires "Require password for sleep and screen saver" set to "immediately" in System Preferences > Security & Privacy > General).

share|improve this answer
Perfect. I always had BTT but never thought they had the option for Switch to Login Screen which does the exact thing !! – Render Sep 27 '12 at 19:59
Not the exact thing: the login screen disconnects wifi, the lock screen does not. – Johann Jul 21 '14 at 18:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.