Skip to content

Instantly share code, notes, and snippets.

@TheTechRobo
Last active July 27, 2019 16:24
Show Gist options
  • Save TheTechRobo/17c721e5ce3894147ef384e6090917d0 to your computer and use it in GitHub Desktop.
Save TheTechRobo/17c721e5ce3894147ef384e6090917d0 to your computer and use it in GitHub Desktop.
lock your Mac from the CLI
import os
print("John Lockeing the computer............")
os.system('/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend')
print("Locked")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment