Put your Mac to Sleep Remotely via eMail or Text Message

Feb 6, 2007 - 4 Comments

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.

The easiest approach is brought to us by Rob Griffiths from MacWorld, who provides an updated version of Timmothy Griffins approach, and goes like this:

  • Create an AppleScript, so launch Script Editor (in /Applications -> Utilities), containing the following three lines:
    tell application "Finder"
    sleep
    end tell
  • 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.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: David Mendez in How to, Mac OS X, Tips & Tricks

4 Comments

» Comments RSS Feed

  1. Dan says:

    Hmmm… What if your computer is already asleep, and you send it a sleep message.

    When you get back and turn it on to retrieve your messages, your sleep message will be among them, and it’ll turn your mac off. I think it might be better if there was some kind of date/time check on when the message was sent, against the time when the computer was last switched on.

  2. Murphy says:

    Dan –
    If you look at the original Tim Margh post he built a pause into the Automator action – and a bounce – so he’s alerted that the Mac is going to sleep. He can cancel the action before it actually goes to sleep. Nice touch.

  3. [...] Alternatively, you can achieve similar with Mail.app itself, have a look at the solution here, but i like mine better. [...]

  4. DAN says:

    I attempted to put this script together, but when I got to the “system” the script was not there (its missing) If someone could tell me how to fix I would really appreciate it

    Thanks!

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates