Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I carry my Macbook Pro (15" Retina, Mid 2012 with Mt. Lion) between my work and home. It is connected to an external HDD as a Time Machine. I always forget to properly eject the HDD before putting my notebook to sleep (I rarely shut it down) at my office.

Is there a way to have it prompt with a custom reminder or warning when I try to put MBP to sleep, using Automator or something?

share|improve this question
Do you put it to sleep by closing the lid? Using the keyboard shortcut? Selecting Sleep from the menu? – Daniel Aug 9 '12 at 16:05
I do it by going to the Apple menu. Closing the lid would not give me any chance to see the warning. – Ki Kim Aug 9 '12 at 18:04
Right. That's why I asked. – Daniel Aug 9 '12 at 18:16
up vote 1 down vote accepted

You can write an AppleScript to do this, then instead of picking sleep from the  menu, you can select your script from the Script menu.

All of this can be set up from within AppleScript Editor:

  • Launch AppleScript Editor

  • Open Preferences

  • Check the box to "Show Script menu in menu bar". enter image description here

  • Create a new script

  • Here is the content of the script:

    display dialog "Are you sure you want to put the computer to sleep?"
    do shell script "pmset sleepnow"
  • Save the script as ~/Library/Scripts/Applications/AppleScript Editor/Sleep.scpt

Now you can put your computer to sleep from the script menu and be warned before sleeping.

share|improve this answer
Thanks, that's pretty much what I was looking for. Will try at the end of the day. – Ki Kim Aug 9 '12 at 21:13

You could have the drive automatically ejected when you sleep the mac instead?

Quick search found Jettison on the Mac App Store

There is also an app you can use to run Apple script on sleep/wake:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.