Murphy Mac - Screencasts and Tutorials » Page 'Sleep Your Mac by Email'

Sleep Your Mac by Email


Smart FolderMurphy picked this tip up from Tim Margh last year and has been using it ever since. The Snippet shows how to configure your Mac to watch for emails matching certain criteria, like a particular subject. When the message comes in your Mac goes off to sleepyland. You could use this technique to have your Mac do other things as well. Perhaps more interesting things.

Some people will say this is stupid, you can simply set your Mac to sleep after x minutes. First of all, that’s no fun. Second, some people don’t want their Mac going to sleep on a timer. Ever.

On occasion Murphy wakes his Mac up remotely and connects with VNC. Sometimes he disconnects without putting the machine back to sleep. Instead of logging back in he just fires off a magic email.

You’ll need to download one file to try this yourself, straight from Apple’s site. It’s a sleeper action for Automator. Run the installer that comes in the dmg. The rest is all built-in.

So click Watch Now to view the screencast as Murphy acts out Tim’s tip. By the way, he uses text messages to sleep his Mac!
ps: Your Mac needs to be turned on, and Mail needs to be running.

Update: What about Windows? You can easily reboot Windows by email. Watch this to see how.

Note: Some readers have pointed out that you can do this whole thing in AppleScript. That’s true. But by using both Automator and AppleScript we’ve shown that you can kick off anything those two technologies can do – by email. Or text message for that matter.

Click for more ways to control your Mac by email.

Watch Now | Permalink

29 comments to “Sleep Your Mac by Email”

  1. It’s nice to know that at least someone other than me found it useful!

  2. Nice – simple way of demonstrating the power of Automator and Applescript.

    My question is, what did you use to do the movie? It would be good for some of the things I teach…

  3. I was wondering the same thing, what did you use to make the movie? Great tip by the way, very useful.

  4. My only question is the Mac going to go to sleep when you have other applications that requires to save to be shut down, i.e. Office’s Word, Excel, etc…?

    Otherwise a great tip!


  5. Ricard – if you’re only putting your Mac to sleep (rather than a full shut down) then there should be no problem with unsaved documents – they’ll be as they were (i.e. still unsaved) when you wake your Mac up.

  6. Thank you!!!
    Now, will it be possible to do the same (sending an email to run a command) and save the open docs and turn off you machine?

    Now I’m visiting your site every day

    thank you for the info!


  7. @Richard, I think that the script can be used to do this. Your script will have to give your document a name, and it will be saved in a default location. I am not an expert on either Automator or AppleScript, but anyone at or or can set you up with the correct script. Hope that helps some.

  8. Also interested in what was used to created the movie…

  9. Sorry guys, Murphy is keeping his production procedures under wraps, for now. It’s a home-brewed and somewhat UGLY solution. But it works and we’re pretty happy with how it looks.
    In the world of Mac tips you’ve got to hold on to any edge you can find!!

  10. Thanks Murphy, I found this which is a lot of steps.
    It might help people.

    One thing that I’ve been looking to do, lately, is to create a Screencast (much like the ones presented by Jon Udell). I went through all the dirty work, trying to find a way to do it that was completely free – no strings attached. The result is usable (albeit, without audio or a mouse cursor) – and certainly a good start. I hope some more (free) screencasting packages get released in the near future.
    Software to Install:

    1. OS X Developer Tools – This package (which is distributed on the OS X install CD) installs all sorts of development goodies that are going to be needed for the next couple appliations. (Unless you already installed it, then just skip this step) If you no longer have your install CD, join the Developer Connection web site, and there should be a version available there for download.
    2. X11 The next step is to install X11 – again, this comes on the installation CD. It use to be available on the Apple web site, but seems to be MIA since Tiger was released.
    3. osxvnc This is a handy, free, application which gets you a super-simple VNC server up-and-running in no time.
    4. Fink Fink is a repository of common, open source, pieces of software. You may also want Fink Commander, which is a nice GUI frontend for Fink (it may come bundled with Fink by default, check first).
    5. ming – Open up Fink Commander and search for the ‘ming’ package (version 0.2a – not 0.3!) and install it.
    6. vnc2swf vnc2swf takes a VNC image stream and converts it into a Flash movie – making it viewable by most of the Web-browsing public. I like to download this package and extract it to my /Applications folder. Once you have it downloaded, open a new Command Line Terminal and type the following commands: ‘cd /Applications/vnc2swf’ (or wherever you extracted your vnc2swf package), ‘./configure –with-ming=/sw’, ‘make’, ‘make install’. You should then have a vnc2swf binary sitting in that directory, ready to play with.

    How To Capture A Screencast:

    1. Start osxvnc. Simply pick the default options and click ‘Start Server’.
    2. Start X11.
    3. In the X11 command window that comes up, type ‘cd /Applications/vnc2swf’ (or wherever you extracted your vnc2swf package).
    4. To start recording, type the following: ‘./vnc2swf -nowindow out.swf :0′. Press ‘F9′ to begin recording and ‘F8′ to stop.
    5. Now type ‘open out.swf’ on the command line to see your finished result! You will want to look over the vnc2swf documentation to see which options will suit your presentation best.

    Happy Screencasting!


  11. Yeah that works but isn’t very useful as you cannot annotate. Murphy, I’m sad you won’t release your trick but I understand. It looks great by the way!!!

    FYI, DebugMode Wink ( does this beautifully for Windows, both the capture and then the additional annotation.

  12. paul, mankoff –

    From what I see on the web there will be some tools for the Mac before too long. Good looking tools. But I don’t think they’ll be free.
    I looked at the vnc2swf solution back in July when I was planning this site – but couldn’t get it to something I was satisfied with. For one thing, I don’t think I was getting a good mouse pointer. I won’t ask if you have made that work since I’m not talking about my solution!
    I’ll reveal my toolkit sooner or later. But my site is quite new and it seems to me I have a window to build up a little audience while I’ve got a lock on this process!!  As soon as some tools come out there will be even more competition for Murphy than there is already.
    I hope you guys enjoy the site. If you have any ideas for screencast material please send them to

  13. Brilliant ideas and have helped me a load!

  14. Nice tip. One question: Will it work if Mail isn’t running?

  15. Scratch that.
    I just re-read the p.s. in the original post.

  16. Thanks for this. I’ve been trying some time to figure out a way to remotely identify my home router’s IP address, such that I can can activate a VNC session with my home Mac Mini (my home IP address is dynamically assigned and ever-changing). I used your tip, along with my first Automator workflow (containing a little Applescript embedded within), to resolve this little conundrum by calling up, stripping out the IP address, and then e-mailing it to myself. I can remotely trigger this activity – as per your tip – by first sending myself an e-mail with a relevant subject line. Works like a charm.

  17. Glad it worked for you! I’ve been trying to come up with some other uses. That’s a good one.

  18. Hi…
    is possible Shutdown Your Mac by Email ????



  19. why use the mac by e-mail? id just use peekamo.

  20. It appears that Automator has been removed from the list of applications available for selection in the automator library. Do you know if this trick is still do-able in Leopard?


  21. Norris – this works by calling a one-line Applescript that calls the Automator stuff.

  22. Awesome tip.. am making a great use of it :)

  23. I can’t get it to work.

    I can run the script and it shuts down. I can run the automater and it shuts down but when the e-mail comes my computer is still on.

    I even went so far as to remove the “pause”

    I’m thinking that the rules are not running. I have had trouble with rule in the past and so far they suck. Have not been able to get them to work. Also, when I double checked the rule… where I hit the [+] and click on Delete… for some reason the “delete” becomes first and the “run apple script” is second…

    However nothing is moving or shutting down.

    Please help.

    I have tried this on both my laptops.

  24. Jennifer – Can you get any script to run by a rule? I think something might have changed in Leopard and you might need to have something in the script if it’s running from a Mail rule. Can’t remember off the top of my head, but I’ll take a look.

  25. Just something I figured out, I run Leopard (not sure if this works on Tiger etc.), but If you have the notification system Growl, you can use it to alert you to when the computer is going to sleep.

  26. Great Tip Murphy!
    Is it possible to wake up your mac from sleep by sending an e-mail?

    Also, is it possible to wake your mac up and put it to sleep by sending a text message to it?

  27. Hi Murphy,

    This is being asked years later! but can you share what the script would be that you mentioned to Norris?

    “Norris – this works by calling a one-line Applescript that calls the Automator stuff.”

    I’m hoping this solution still works using Snow Leopard.

  28. Thanks for ones marvelous posting! I really enjoyed reading
    it, you happen to be a great author. I will be sure to bookmark your blog and will come
    back very soon. I want to encourage one to continue your
    great work, have a nice afternoon!

  29. Google, in its constant effort to enhance search outcomes, downgrades any web site that artificially boosts its
    position. Within the distant past this was carried out by techniques like key phrase
    stuffing, and serving up a distinct web page to a search spider verses
    an actual customer. Then the manipulation moved on to artificial hyperlink
    building and hyperlink exchanges.

Leave a comment