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:
- Open the Automator application.
- When the welcome screen pops up select Custom and click Choose.
- On the left side under Actions navigate to Library>Utilities.
- In the second window select “Run Shell Script” and drag it in to the area on the right.

- Copy and paste the code above into the text area.

- 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.

- 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.
3 Comments
very cool
can i publish this on my site?
…one more hint, i had to use back slash between Menu Extras (Menu\ Extras) instead of double quotes
Yes, feel free to publish this on your site. Thanks for the hint