Logout User on Command Line in Mac OS X

Logout User on Command Line in Mac OS X

Source: https://apple.stackexchange.com/a/126762

Login as that user eg. sudo su - username

Ask for confirmation:
[bash]
osascript -e ‘tell app "System Events" to log out’`
[/bash]

Just do it:
[bash]
osascript -e ‘tell app "System Events" to «event aevtrlgo»’
osascript -e ‘tell application "loginwindow" to «event aevtrlgo»’
[/bash]

Yes, the symbols « and » are correct.

Leave a Reply

Your email address will not be published. Required fields are marked *