Thursday, March 21, 2013

Lock Your OSX Computer

Fun tip. It is not obvious how to lock an OSX computer without logging off. After some searching a ran across a Gist which suspends the current session. This is equivalent to locking (Win+L) a Windows computer.
    #!/bin/bash
    /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
If you save that into a file, you can make it executable by running:
    $ chmod 755 lock
This works great since I always have a terminal window open. Presuming the file is accessible via the path. I can just run the following and it locks the Mac.
    $ lock

No comments: