Ever wish you could get more information about Time Machine? You can!

Q: Have you ever wanted to know what Time Machine was doing from the Terminal?

A: Enter tmutil currentphase and it give you a one word¹ summary of its current state.

Q: “But I want way more nerdy information than that!”

A: Ok, well, that wasn’t really a question, but… tmutil status will give you loads of information, like this:

Backup session status:
{
    BackupPhase = Copying;
    ClientID = "com.apple.backupd";
    DateOfStateChange = "2019-11-19 02:03:41 +0000";
    DestinationID = "B3D2100F-5891-4961-94E6-BDD11341CD2F";
    DestinationMountPoint = "/Volumes/Time Machine Backups";
    Percent = "0.66183638184673";
    Progress =     {
        TimeRemaining = 3088;
        "_raw_totalBytes" = 46498717972;
        bytes = 34193936959;
        files = 17200;
        totalBytes = 51148589769;
        totalFiles = 17200;
    };
    Running = 1;
    Stopping = 0;
    "_raw_Percent" = "0.7353737576074778";
}

Q: OK, but what if I want that in a nicer format?

A: Ah, well, then you want this:

which is a set of free shell scripts that I’ve put together to parse the most important pieces of information into a much nicer format and show them in your menu bar if you use TextBar.

Then you can see both the “raw” output from tmutil status as well as a nicer summary at the top, like this:

and you’ll be the envy of all your friends.

Well, at least your nerdy Mac friends.


¹ well, it’s kinda one word, and kind of 1-or-more-words-all-squished-together. Here’s a list of all of the phases that I’ve seen:

  • BackupNotRunning
  • Copying
  • DeletingOldBackups
  • Finishing
  • HealthCheckCopyHFSMeta
  • HealthCheckFsck
  • MountingBackupVol
  • MountingBackupVolForHealthCheck
  • Starting
  • ThinningPostBackup
  • ThinningPreBackup
13 Likes

Thanks for this, great scripts - when used with bartender and set to hidden but ‘show for updates’ selected it negates the need for notifications, and bartender shows me when TM is finished. Perfect :slight_smile:

1 Like

Very good point! I hadn’t used it that way, but I might!

One other improvement might be to use the DestinationMountPoint rather than DesitnationID for the ‘Last Backup To’ when TM isn’t running - if that’s possible?

It should show both. Here is what mine looks like after it backed up to my Time Capsule:

Interesting… mine has nothing in the brackets

So my code for getting the name obviously failed for your drive. I just don’t know why.

I’d be curious to know how it appears when Time Machine is running.

If you happen to notice TM running, switch to Terminal and enter this line:

tmutil status | pbcopy

That will copy the status info to the pasteboard. Then either post it here or send it to me in a private message.

Thanks!

Thank you for this @tjluoma!

Just bought Textbar, nice little utility.
Hope you can just confirm something before I install – since what I know about Terminal could be fit on the back of a postage stamp :face_with_raised_eyebrow:

In your instructions – after placing the four .sh files inside the appropriate folder, you write the following:

" Make sure they are executable: chmod a+rx /usr/local/bin/*.sh "

So, silly question of the week – does this mean I must run that exact command inside Terminal, to make them(?)/check that they are already(?) executable?

Figured it would be wiser to check this first, before going any further!

That command will make every file in that directory (/usr/local/bin) ending with “.sh" readable (the “r”) and executable (the “x”) for all users (the “a”).

1 Like

Sorry, I should have explained that more clearly, but @jec0047 said it perfectly.

Yes, just enter that line verbatim and it will make the script executable for everyone.

1 Like

Done :slight_smile:

Backup session status:
{
BackupPhase = Copying;
ClientID = “com.apple.backupd”;
DateOfStateChange = “2019-11-26 08:52:13 +0000”;
DestinationID = “A0F07BDA-78EE-41F5-8BB4-44A7403AC502”;
Progress = {
Percent = “0.005028278317253894”;
“_raw_Percent” = “0.005028278317253894”;
“_raw_totalBytes” = 2943923758;
bytes = 14802868;
files = 658;
totalBytes = 2943923758;
totalFiles = 5737;
};
Running = 1;
Stopping = 0;
}

One thought that springs to mind is that it could be a Catalina change if you haven’t upgraded.

tmutil destinationinfo

displays all the location name info.

Ah… that’s true, I haven’t updated to Catalina. I have it running in a VM, but that won’t help for Time Machine.

I wonder why they would remove DestinationMountPoint from tmutil status though…

Good point.

So if you look at textbar-timemachine.sh for this line:

	# get the mount point
DESTINATION_NAME=$(awk -F'"' '/DestinationMountPoint/{print $2}' "$CURRENT_STATUS" )

and add these lines after it (leave a blank line or two for readability):

[[ "$DESTINATION_NAME" == "" ]] \
&& DESTINATION_NAME=$(tmutil destinationinfo \
| fgrep -B1 "$DESTINATION_ID" \
| egrep '^Mount Point '  \
| sed 's#^Mount Point   : ##g')

That should try both methods of setting DESTINATION_NAME correctly.

Thanks for this @tjluoma!