Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to lock my Mac running OS X 10.8 after it has powered up with a script.

I have autologin enabled.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Open the AppleScript Editor, and type in this command:

/System/Library/CoreServices/Menu\ Extras/ -suspend

Save it as a script file. Then, open your System Preferences, go to Account, and add it to the programs that will run upon login.

This command will not log you out; it does the same thing as using the fast user switcher.

share|improve this answer
I don't know of a better solution than Stephen's (I use it myself) but it's worth noting this isn't 100% secure. Login items can be disabled by pressing a key combination as the login process begins. I'm omitting the specific combination but anyone can figure it out. –  user238042 Jul 14 '13 at 13:34
@FormerMacGenius Good to know. I hadn't thought of that. Depending on the Questioner's situation it may or may not be sufficient for their purpose. –  Stephen Schrauger Jul 14 '13 at 17:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.