Put your Mac to Sleep Remotely via eMail or Text Message
How many times have you left your Mac on, and later while you’re out and about you wish you would have turned the thing off or put it to sleep? Wouldn’t it be nice to be able to put it to sleep remotely with a quick email or text message? You can, and it’s easier than you’d think. You’re just a simple AppleScript and a few Mail rules away from putting your Mac to sleep from virtually anywhere. We’ll show you how to do it, but if you’re still confused then a screencast demonstrating the technique is also available:
Updated: 3/14/2012 A modernized version of this lets you use SSH or an iPhone for remote sleep.
- Create an AppleScript, so launch Script Editor (in /Applications -> Utilities), containing the following three lines:
tell application "Finder"
- Save this script as SleepMac (or whatever, as long as you can find it later)
- Launch Mail.app
- Open Mail’s Preferences and click on the Rules icon in the toolbar. When the Rules panel appears, click Add Rule. In the new window that appears, give your rule a name (Sleep Mac) and then create a set of conditions to insure that the rule will only act on the e-mails you want it to act on. This can be any combination of sender, recipient, subject, content, and so forth that you like. Here is how it is setup on the MacWorld demo:
- Be sure to select your saved AppleScript in the “Perform actions” setting
- That’s it! Now your Mac will sleep if you send an email or text message from the address you specified. Be sure to leave Mail.app running otherwise the trick won’t work properly.
- If you are confused, try watching this screencast from MurphyMac.com for a visual walkthrough. It follows the older approach, but you can apply the new rules to the old method.