"I have discovered the hard way that Apple's "Migration Assistant" doesn't always preserve file timestamps"
comment: It seems that has become Apple's MO - you must discover all things the hard way.
Caveats: I'm not entirely sure this will resolve your issue or answer your question, but I hope it will help. I don't actually know what Migration Assistant does because in 12 years and 5 different Macs, I have never used it. So this answer may be a partial answer, or it may be incompatible with Migration Assistant. As a guess, I'd say use rsync
after Migration Assistant - to clean up the mess it has left. In other words, rsync
can likely restore not only the timestamps lost by MA
, it can also restore all file metadata that may have been lost. Others here may have better ideas; my answer will be limited to rsync
.
I used rsync
version 3.2.4 for this answer, installed from MacPorts. I do not know if the rsync
version included with your version of macOS includes the required options shown here - you may wish to investigate that instead of installing a current version of rsync
.
Background: I've begun using rsync
as my primary backup tool for macOS recently, and had to address some of the same issues as you: mangled and missing metadata. In my case the issue was caused by crossing a file system boundary - from APFS
on my local drive to btrfs
via SMB on a Synology NAS. In your case - Migration Assistant - I cannot even imagine how it could not even get the timestamp metadata correct, but you're certainly not the only one who's reported such issues.
I made some notes while working to resolve my issue, and they morphed into a "recipe" on my macOS GitHub repo. I'll try to keep this answer rather brief since most of the details are covered in that document.
rsync with metadata preservation
rsync
effectively copies data from a source (the "from" location) to a destination (the "to" location). If you are using a fileserver (NAS) as an intermediary between your two Macs, these commands should do what you need. I don't see any need to involve an intermediate NAS, but it may be convenient or desirable if you want a backup. You should be able to accomplish the rsync
operations over an SSH connection; the following commands illustrate the syntax & options needed regardless of whether you use the intermediary NAS or not:
from "old Mac" to NAS:
Assuming the source & destination folders are:
SOURCE: /Users/MyHome/MyData/
DESTINATION: /System/Volumes/Data/mnt/MyNAS/
From a terminal on your "old Mac":
% SRC-FLDR="/Users/MyHome/MyData/"
% DST-FLDR="/System/Volumes/Data/mnt/MyNAS/"
% rsync -rlAXtgoDivv --dry-run --fake-super $SRC-FLDR $DST-FLDR > rsync.log 2>&1
Explanation: This rsync
command uses the --dry-run
option, and therefore will not actually move or modify any files. It will give you a detailed log (the ivv
options) of what files would have been moved or modified. Once you are happy with the results, simply remove the --dry-run
option, and run again for effect. Review the rsync.log
file using the "Decoding Table"
from NAS to "new Mac":
SOURCE: /System/Volumes/Data/mnt/MyNAS/
DESTINATION: /Users/MyNewMacHome/MyData/
From a terminal on your "new Mac":
% SRC-FLDR="/System/Volumes/Data/mnt/MyNAS/"
% DST-FLDR="/Users/MyNewMacHome/MyData/"
% rsync -rlAXtgoDivv --dry-run --fake-super $SRC-FLDR $DST-FLDR > rsync.log 2>&1
from "old Mac" to "new Mac"
If you can make an SSH connection between your "old Mac" & "new Mac", it's not necessary to involve an intermediate NAS. The same rsync
options may be used; I'll leave it to you to formulate the SOURCE and DESTINATION folders.
Verifying Results:
The GitHub recipe includes a short zsh
script that will stat
all of the files, folders, links, etc between the SOURCE and DESTINATION folders. It may be run following rsync
operations to verify that at least the chosen stat
attributes are the same.
The rsync
options presented here will do more than preserve the metadata containing the date-time stamps; they will also preserve all extended attributes. The GitHub recipe also includes simple script to compare the output of xattr -lrsvx
for all files (that have xattrs
) in the SOURCE and DESTINATION directories.
The stat
utility that I use here is the GNU coreutils version 9.1. The find
version I use is the GNU findutils version 4.9.0. Both are readily available through MacPorts, and available for virtually every version of macOS. The xattr
command is a macOS utility.