In the interests of security it’s best to lock your machine as soon as you leave it. Perhaps more relevant to an iMac over a MacBook (as im sure you would never leave your MacBook unattended) but still important either way.
There are a few options for locking your machine, i recently blogged about one of the more geeky methods ‘AirLock
‘ which uses a bluetooth proximity system to lock you’re machine when you are more then a specified distance away. However, as we all know bluetooth sucks power faster then a Dyson vacuum cleaner sucks sand in a desert. So for a less ‘power hungry’ method you can use the ‘Automator
‘ to build a shortcut which locks the screen at the click of your mouse.
This method using a single line of ‘shell code':
/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession -suspend
Which uses the ‘fast users’ switching method to secure your mac. Not only is this click and simple, but it’s also quite cool as the Mac screen will rotate round in a ‘cube’ like motion.
To turn this line of code into a shortcut you can run, start the Automator application using you’re favourite app launcher or click the icon in the Applications folder.
Once launched you will be presented with a choice of templates for your Automator project. For this particular project select the ‘Application’ template. Once the template has done loading type ‘Run’ into the search panel on the left. You should see the list filtering away to leave a collection of options. Double click on the ‘Run shell script’ option. Once done amend the code in the Shell script window so it looks like the following screen shot:
Once done, you can either test it using the ‘Run’ button, or save it to a location of your choice.
Now all you need to do is click the .App file to lock your machine.
If you’re feeling a bit more adventurous you can use the ‘Automator’ application to expand the project and add user prompts or logging etc.