Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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'm one of those greatly suffering from the problem with TM in which the entire backup sparsebundle on a NAS gets corrupted if the Mac goes to sleep in middle of a backup operation. There's a long process for recovering the backup, but it would be far better to avoid the corruption in the first place.

Is there any way to hack the sleep function so that the Mac refuses to go to sleep if a TM backup is currently in progress? Or, if that's not possible, is there at least some way to show a confirmation dialog when manually choosing "sleep" from the apple menu, to prompt for a manual verification that no TM is currently running?

Clarification: One of the situations I need to protect against, is my habit of manually choosing "sleep" from the apple menu. Hence, something like Caffeine which only prevents automatic sleep, isn't a solution for me.

share|improve this question
As a last resort you could try using the Caffeine app ( When you start Caffeine an icon will be placed in the menu bar that will allow you to prevent your Mac from going to sleep when enabled. A better solution would be if you could find a way to automatically disable sleep before TM starts and reenable sleep after TM quits. Someone who knows AppleScript could probably put something together pretty easily. – recklesscoder Apr 13 '13 at 15:20
@recklesscoder please see clarification. – GJ. Apr 13 '13 at 18:31

I have solved this with a bash script. It involves caffeinate built-in command and NoSleepCtrl (prevents sleep on lid close).

In my setup, I have TimeMachine disabled and run it using this command. It should not be difficult to create a wrapper, which would execute it periodically and either ask user for confirmation or wake the computer up and do it automatically.

My experience and steps for TM backup corruption on QNAP.

share|improve this answer
please see clarification. – GJ. Apr 13 '13 at 18:32
Give try to the NoSleep utility. It does prevent sleep, even if you invoke Sleep from menu. I have checked it using simple: while true; do date; sleep 1; done. On caffeinate only it stops; with NoSleep screen goes blank, but loop does not stop. – brablc Apr 13 '13 at 18:50

Yeah, I was thinking of recommending the Caffeine app, especially if you are in the habit of kicking off Time Machine backups manually.

Another option might be to go into System Preferences > Energy Saver and setting your computer sleep timer to closer to 3 hours. Be advised, though, that this will increase the amount of energy your computer is consuming (since it will be awake longer for each session). You can keep your display timer down to a more reasonable duration to save power. Display sleep won't affect Time Machine.

share|improve this answer

I just ran into this new addition -- the caffeinate command is built into OS X now, no app needed.

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.