Mac Security: Lock your Mac without logging out

My new favorite way to lock my Mac:

/System/Library/CoreServices/”Menu Extras”/User.menu/Contents/Resources/CGSession -suspend

This is a simple command that can be run from Terminal.  You get a cool animation from your desktop to the lock screen, and you can’t get back in without the password.  If you want to learn how to use Automator and set it up yourself, feel free to read on.  If you’re just interested in getting the app, you can download it here.

“But wait, you mean I have to open Terminal and enter that every time?” Nope.  You can set up an automated script and assign a hotkey to it.  Here’s how:

  1. Open the Automator application.
  2. When the welcome screen pops up select Custom and click Choose.
  3. On the left side under Actions navigate to Library>Utilities.
  4. In the second window select “Run Shell Script” and drag it in to the area on the right.
  5. Copy and paste the code above into the text area.
  6. Go to File > Save As… and save your Workflow as an Application.  I’ve named mine “Suspend” and placed it in the Applications/Utilities folder.
  7. Now you can just run Spotlight (default hotkey: Command + Space Bar) and start typing in “suspend” and voila!  Select it and test it out.

Again, if you don’t want to go through all that trouble, you can always just download my version (which I created using the above steps).  You can download it here.

This entry was posted in apple and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. smugg
    Posted January 22, 2009 at 11:05 am | Permalink

    very cool :) can i publish this on my site?

  2. smugg
    Posted January 22, 2009 at 11:11 am | Permalink

    …one more hint, i had to use back slash between Menu Extras (Menu\ Extras) instead of double quotes

  3. Posted January 22, 2009 at 12:01 pm | Permalink

    Yes, feel free to publish this on your site. Thanks for the hint :)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  •  
  •