![]() The latter AppleScript is also used in our guide on how to remotely put a Mac to sleep using an iPhone or ssh. Osascript -e 'tell application "System Events" to sleep' You can also target the application “System Events” if you do encounter something preventing sleep: Enter the halt command syntax exactly as described: Hit the return key, authenticate with sudo to instantly shut down the Mac. Using either method should override anything else running in Mac OS X and force the system to sleep. How do you shutdown a Mac from the terminal Shutting Down a Mac via Terminal with ‘halt’ Open the Terminal. ![]() Osascript is a command line tool that runs OSA scripts, the -e flag executes the script in quotes rather than looking for a file, and the text in quotations is basic AppleScript. Osascript -e 'tell application "Finder" to sleep' To perform all three operations you can use the shutdown command, which Close down the system at a given time. The syntax for the AppleScript sleep method is as follows: Using AppleScript from the command line is another way to instantly initiate sleep from Terminal. How to Put Mac to Sleep from Command Line with AppleScript ![]() That is one of the most simple uses of pmset, which is a full featured power management utility.Īs mentioned, sleep happens immediately, so if you aren’t ready for that you may want to apply a wait, or use a variation of the next trick since AppleScript can be scheduled easily. Hit return and the Mac is instantly put to sleep. The first trick uses pmset and the following command syntax: Remember there is no warning, sleep is immediate. To try this yourself, launch Terminal and use one of the following commands. How to Put a Mac to Sleep from Command Line of Mac OS X with pmset We’ll show you two ways how you can initiate sleep on any Mac by using the command line.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |