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?

  • 1
    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

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.

| 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 http://itunes.apple.com/us/app/jettison/id447430809?mt=12

There is also an app you can use to run Apple script on sleep/wake: http://www.lagentesoft.com/scenario/index.html

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .