How do I eject the Time Machine backup drive automatically after each backup? How do I set Time Machine to eject my external Time Machine backup drive automatically after each backup?
~/bin/timemachine:

#!/bin/bash

d="Time Machine"  # (change this to match the name of your backup drive)
diskutil mount "$d" &amp;&amp; tmutil startbackup -b &amp;&amp; diskutil eject "$d"


~/Library/LaunchAgents/timemachine_eject.plist:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;timemachine_eject&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/Users/username/bin/timemachine&lt;/string&gt; &lt;!-- Replace "username" with your username. "~/bin/timemachine" doesn't work --&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;120&lt;/integer&gt; &lt;!-- run every two minutes for testing. --&gt;
        &lt;!-- Change this to a higher number like 43200 (run every 12 hours) once you've confirmed it works. --&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Make the script executable, unload the default plist, and load the new one:

chmod +x ~/bin/timemachine
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.backupd-auto.plist
launchctl load ~/Library/LaunchAgents/timemachine_eject.plist


Any time you want to make changes to the plist file, you have to unload and load it:

launchctl unload ~/Library/LaunchAgents/timemachine_eject.plist
launchctl load ~/Library/LaunchAgents/timemachine_eject.plist