Why Time Machine missed some directories?

Ivan Zabrovskiy
2 min readMar 2, 2019

--

Recently I restored my MacBook from backup and find what most of installed apps lost its data. This is very unpleasure. That is why here I will describe some features of Time Machine and provide a way to check and configure your backup as you wish.

What’s happens?

After restoring of the MacOS, I lost ~/Library/Application Support/ directory. This is place, where stored data the most applications. For example: Skype, Sublime, Firefox, Slack, VPN-clients and so on.

As I understand from googling, this is not a single case. For example, here, here and here are the same cases.

Moreover, from 59 directories in ~/Library/ I can find only 54 in Time Machine backup. It was strange for me, because in TM interface I have no excluded directories at all.

Where is the rest?

Time Machine is not rsync. Because TM has lots of custom logic and there is several places where TM store a list of excluded dirs.

  1. First place is a config of backupd . It’s located in /System/Library/CoreServices/backupd.bundle/Contents/Resources/Std/Exclusions.plist . There are lots of exclusion. Most part of it related with system temporary data and with cache.
  2. All installed applications can add their own exceptions. These can be found by following command: sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
  3. Unfortunately, exists dirs, which are excluded, but not mentioned in both of the previous lists. And there is no simple way to get list of it. You just can call tmutil isexcluded ~/Library/Application\ Support/ for a single dir and get something like [Excluded] /Users/username/Library/Application Support.

Find them all

To find all excluded directories needs to recursively call tmutil. Buttmutil hasn’t recursive commands. So, needs to use bash-script like follows:

You create a script with described content and call it passing a path as an argument. For example: ./recursive_tmutil.sh ~/ . Then wait 20–40sec and take a look at the result.

All directories from result are excluded from your backup. If you want to return it back — call this command with a desired directory as the argument: tmutil removeexclusion /full/path/to/directory.

Finally, you can call script for the root path: ./recursive_tmutil.sh / and validate a result. But in this case it takes couple minutes.

Be wise and prepare your backup before you will really need it, not after.

--

--