Created
April 5, 2015 00:39
-
-
Save Akira-Hayasaka/026b7c7ae611bc7485e4 to your computer and use it in GitHub Desktop.
osx shutdown, restart, sleep script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shut down without showing a confirmation dialog: | |
osascript -e 'tell app "System Events" to shut down' | |
Shut down after showing a confirmation dialog: | |
osascript -e 'tell app "loginwindow" to «event aevtrsdn»' | |
Restart without showing a confirmation dialog: | |
osascript -e 'tell app "System Events" to restart' | |
Restart after showing a confirmation dialog: | |
osascript -e 'tell app "loginwindow" to «event aevtrrst»' | |
Log out without showing a confirmation dialog: | |
osascript -e 'tell app "System Events" to «event aevtrlgo»' | |
Log out after showing a confirmation dialog: | |
osascript -e 'tell app "System Events" to log out' | |
Go to sleep (pmset): | |
pmset sleepnow | |
Go to sleep (AppleScript): | |
osascript -e 'tell app "System Events" to sleep' | |
Put displays to sleep (10.9 and later): | |
pmset displaysleepnow | |
https://developer.apple.com/library/mac/qa/qa1134/_index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment