Mac OS X: Wake up from sleep and login last user via ssh

caffeinate -u -t 2 osascript -e 'tell application "System Events" to keystroke "mypassword"' osascript -e 'tell application "System Events" to keystroke return'
For Mac OS X. Connecting via ssh and sending these commands will wake up your machine and login using password and last logged user.

I needed in a project using Mac OS X as Monitor for special application controlled remotely.

For going back to sleep: $> pmset displaysleepnow

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.