19

I have a Mac running Time Machine and it has dozens of exclusions that were added through the Time Machine UI.

How can I export this list?

Using tmutil in Terminal, I am able to access Time Machine backups and configuration.

The tool has the following commands related to exclusions:

tmutil addexclusion [-p|-v] item ...
tmutil removeexclusion [-p|-v] item ...
tmutil isexcluded item ...

Is there any way to list the existing exclusions without using isexcluded on specific files and folders?

2 Answers 2

30

Here are 4 ways of getting Time Machines exclusions:

Firstly, every backup includes its own exclusion list. At the top level of each backup there is a hidden file called .exclusions.plist, for example /Volumes/<TM volume name>/2022-05-03-124500/.exclusions.plist. You can see this in Finder so long as you are showing hidden files by pressing Shift and Command and then the dot (or >) key.

The file has exclusions of 4 types:

  • Standard exclusion paths,
  • Sticky exclusion paths set on particular files (lots of these),
  • System files excluded - there are none (I suspect it is a relic from older versions of TM), and
  • User exclusion paths - those set in Time Machine's System Preferences.

So the list you want is at the end of the file.

Howard Oakley's blog has the best reference for the above What doesn't Time Machine back up?

Secondly, Time Machines preference file contains the list of locations added in Time Machine's System Preferences. This is /Library/Preferences/com.apple.TimeMachine.plist.

This preference file does not include individual files with exclusion set or the standard exclusions.

Thirdly, and thanks to @Gordon Davisson, here is a simple one-liner for the exclusions added in the GUI:

defaults read /Library/Preferences/com.apple.TimeMachine SkipPaths

Edit two years later, by request and for completeness:

Fourthly, as well as the various lists above, exclusion can be attached to individual files and folders as an extended attribute. For volumes with a Spotlight index, these can be found with:

sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"

Most of these are for files and folders which are not required for system recovery and which, if needed, can be rebuilt. It contains some items which, at first sight, are surprising - e.g. exclusions within Photos libraries.

10
  • 3
    You can print the user exclusion paths with defaults read /Library/Preferences/com.apple.TimeMachine SkipPaths. Also, defaults read /Library/Preferences/com.apple.TimeMachine SkipSystemFiles will print "1" if system files are excluded; not sure if it prints "0" or an error if they're not. May 3, 2022 at 4:21
  • @GordonDavisson That is perhaps a better answer! re skipsystemfiles, my Mac says 0.
    – Gilby
    May 3, 2022 at 4:33
  • 5
    I also suggest sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'" because the commands above don't show a completed list for me. Source github.com/stevegrunwell/asimov#how-it-works
    – CAMOBAP
    Sep 26, 2022 at 5:47
  • @CAMOBAP I didn't include that because the question was about listing exclusions added through the GUI. But it is important to know how to list exclusions created as an extended attribute on individual files.
    – Gilby
    Sep 26, 2022 at 10:05
  • 1
    @Dr.Hans-PeterStörr You are right. I have added a fourth section.
    – Gilby
    Apr 17 at 22:48
0

tmutil Exclusion on Sonoma 14.4.1 and OCLP 1.4

im having a similar problem — trying to create a time machine backup of my father's Home directory — his iMac crashed, and this is the only copy that exists.

i tried several times to create a time machine backup, and it succeeded in making a backup, but excluded the User directory that was the Main thing!! 😳 In Time Machine > Options it showed: ~ in the Exclusion List — however, selecting it and clicking '-' would not Remove ~ from the Exclusion List — leaving me with no way of creating a Time Machine backup (and saving almost a Decade of Local eMail in his /Library/Mail/v10/ folder, and his Photos Library and /Documents.

then i found this useful thread — and did the following:

sudo tmutil removeexclusion -p ~

and this managed to remove it when the GUI was not able to do it. thanks for all the help!!

john penner jr (toronto island)

You must log in to answer this question.

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