Mac – Size of Time Machine local snapshots from the command line

terminaltime-machine

Is there a way to (quickly) find out the size of the local Time Machine snapshots from the command line?

I can list them

$ tmutil listlocalsnapshots /
com.apple.TimeMachine.2018-02-14-104557
com.apple.TimeMachine.2018-02-14-160009
com.apple.TimeMachine.2018-02-14-182704
com.apple.TimeMachine.2018-02-14-203310
com.apple.TimeMachine.2018-02-14-212838
com.apple.TimeMachine.2018-02-14-222703
com.apple.TimeMachine.2018-02-14-233021
com.apple.TimeMachine.2018-02-15-002833
com.apple.TimeMachine.2018-02-15-012709
com.apple.TimeMachine.2018-02-15-022703
com.apple.TimeMachine.2018-02-15-032704
com.apple.TimeMachine.2018-02-15-042703
com.apple.TimeMachine.2018-02-15-052703
com.apple.TimeMachine.2018-02-15-062704
com.apple.TimeMachine.2018-02-15-072832
com.apple.TimeMachine.2018-02-15-082706

But I did not find any tmutil verb regarding the size.

With du I get a lot of errors and it takes a lot of time

sudo du -hs  /Volumes/com.apple.TimeMachine.localsnapshots/
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/db/ConfigurationProfiles/Store: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/5n/5z9scwyj25b37mkqg3ltgx0m0000gq/0/com.apple.LaunchServices.dv: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/sq/sb7jrfk14qv7yyh9z55mszp40000gn/0/SafariFamily: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/sq/sb7jrfk14qv7yyh9z55mszp40000gn/0/com.apple.LaunchServices.dv: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/sq/sb7jrfk14qv7yyh9z55mszp40000gn/0/com.apple.nsurlsessiond: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/sq/sb7jrfk14qv7yyh9z55mszp40000gn/0/com.apple.routined: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/2f/7t6rd_vd2jnc0twnyb2bltvr0000gp/0/com.apple.LaunchServices.dv: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/37/__tp_5v96bx012sqphn10wlm0000gr/0/com.apple.LaunchServices.dv: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0/com.apple.nsurlsessiond: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/gy/k8z6qc3d4pndcgqrlqjqylrh0000gs/0/com.apple.LaunchServices.dv: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/gy/k8z6qc3d4pndcgqrlqjqylrh0000gs/0/com.apple.nsurlsessiond: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/gy/k8z6qc3d4pndcgqrlqjqylrh0000gs/0/com.apple.routined: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/cl/4p6t853n0nd2wmx7q3ljvrnh0000gt/0/SafariFamily: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/cl/4p6t853n0nd2wmx7q3ljvrnh0000gt/0/com.apple.LaunchServices.dv: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/cl/4p6t853n0nd2wmx7q3ljvrnh0000gt/0/com.apple.nsurlsessiond: Operation not permitted
du: /Volumes/com.apple.TimeMachine.localsnapshots//Backups.backupdb/Matteo Corti’s MacBook Pro/2018-02-15-002833/Macintosh HD/private/var/folders/cl/4p6t853n0nd2wmx7q3ljvrnh0000gt/0/com.apple.routined: Operation not permitted
^C

With the GUI (About this Mac > Storage) I get the information in few seconds (so it must be cached somewhere).

Best Answer

Take a look at the "Storage" tab of "About This Mac" from the Apple menu (System Information.app). It should show as one of the colored portions of the bar. The cool thing is, with APFS and its file-and-block level cloning, the answer is probably "not a whole lot". I know it can seem strange. If you haven't experienced this yourself yet: take a big file (5-6GB) and use cp -c to copy it 20 times. You won't see a byte more of storage used until you edit any of the copies. du doesn't look that "deep" (to the level of block allocation), so it will double count everything.

If you have a LOT of very large and very rapidly changing files (like you're editing a feature film or something), where lots of changes are made to very large files multiple times a day, it might be world disabling local snapshots. But honestly I wouldn't worry about it unless its seriously impacting your work or something. Time Machine knows how and when to prune older backups to make sure it doesn' t overgrow itself.

Related Question