Curious if there is an easy way to send a background email alert if a Time Machine backup fails (or continuously fails rather than just one time)

I've found TM Error Logger however, it cannot run in the background, and also generates the email through the systems default mail client, which then needs to be manually sent.

Ideally I'd like a solution that does this in the background without any input or action from the end user - so that I can be notified if their machines aren't backing up.

The trouble is many users don't realize that Time Machine may not be working for them - they don't know to look for the "!" in the TM menu bar icon (or often what it means)

  • If you want more robustness you should investigate in making the mail system on the machine work properly. This will allow you to buffer mails if the outgoing connection for any reason is down. – Thorbjørn Ravn Andersen Oct 6 '12 at 22:03

I recently released a Mac app called TMNotifier that will run in the background and notify you when a Time Machine error occurs. It also doesn't depend on the default mail client, since it lets you configure SMTP in the app itself.


Here's an example of what the alerts look like:

  • Thanks for making this! I can't believe Apple hasn't made it easier to monitor time machine. Most users don't bother checking it and/or ignore pop up warnings. – Josh Newman May 26 '15 at 12:46
  • Not a problem! I'm glad I could help. – James Barclay May 27 '15 at 15:28

This is a great use case for a simple shell or python or ruby script and launchd.

I'll assume you can find on this site how to configure the launchd item or want to buy Lingon which is a great timesaver. (Be aware Lingon 3 is for Lion and there is another also paid version for Snow Leopard just named Lingon on the App store)

You also will need to set up an internal mail server that accepts command line mail from all your clients, so there is that large chunk of setup.

With all that "hand waving" to explain broad concepts - you now could use these core commands to get the job done:

  • tmutil latestbackup
  • date "+%Y-%m-%d"
  • mail -s "TimeMachine Failure Report from $HOSTNAME" "This mac needs attention"

Depending on how much fun this sounds, you can pick apart each task and work on them or look into software that is designed to do this for you like Apple Remote Desktop or Robot Cloud.

  • Thanks - that's a great answer, however I'm hoping for something simpler, and ideally prepackaged. I guess where it could fall apart is on the emailing side, since it would require SMTP credentials to successfully send email – Josh Newman Nov 16 '11 at 22:08
  • 1
    The last two links I put in the article are pre-packaged solutions. ARD is scriptable with Automator or Apple Script so you can easily pull the information. The other is a software as a service that is incredibly powerful and $5 per monitored machine. – bmike Nov 16 '11 at 23:03

As bmike says, you can use lingon. or manually make you own launch agent

Here is a test example. My time machine device was not plugged in. So backups would fail.

I used an applescript saved as text and with the osascript shebang at the top.

property i_The_Sender : "senderAddress1@ip.com"
property theAddress2 : "recipientAddress@ip.com"
set userNAME to ""
tell application "System Events"
    set userNAME to full name of current user
end tell
property theSubject : "TimeMachine Failure Report from "

set tm to do shell script "/usr/bin/syslog -F '$Time $Message' -k Sender com.apple.backupd -k Time ge -59m | tail -n 3"

if tm contains "failed" then
    set otherLog to do shell script "/usr/bin/syslog -F '$Time $Message' -k Sender com.apple.backupd-helper -k Time ge -59m | tail -n 20"
    tell application "Mail"
        set newMessage to make new outgoing message with properties {subject:(theSubject & userNAME), content:tm & return & otherLog}
        tell newMessage

            set visible to false
            set sender to i_The_Sender
            make new to recipient at end of to recipients with properties {address:theAddress2}

            send --<<<<---------------- change save to send to send or send to save to save in drafts

        end tell
    end tell

end if

This means I can run the Applescript as a native shell script.

The script will also send the email in the background. It does launch mail.app but not in focus. Nor will it bring mail.app to focus if mail.app is already running.

chmod the applescript text file as you would a normal wheel script file to give it execute permissions .ie. chmod a+x /path/tp/file

Using lingon: choose the file and you run options. Save and load. If you do it manually then place the file you launch agent file in ~/Library/LaunchAgents/

enter image description here

  • How can this script be modified so that it will also send email notifications whenever a Time Machine backup is successful or if there are any warnings or notifications about the Time Machine backups? I need to be notified about everything having to do with the Time Machine backups. – Tech Support Nov 2 '17 at 0:28

Time Machine failing - get alerted by Growl I think it already says it. But okay... I wrote a script which checks the age of the last successful time machine backup and alerts by growl if it is too old.

  • Welcome to Ask Different! Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. – gentmatt Oct 6 '12 at 22:31

You must log in to answer this question.

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