Set a file's creation date with SetFile -d
Apple's SetFile tool reaches the one timestamp touch cannot change on macOS: the HFS+ creation date shown in Finder's Get Info panel.
Run `SetFile -d '01/15/2026 08:30:00' report.txt` to rewrite the file's creation date in MM/DD/YYYY HH:MM:SS form.
01Command
Command
$ SetFile -d '01/15/2026 08:30:00' report.txt
ls -l -D report.txt02What it does
SetFile manipulates classic Mac file attributes; -d sets the creation date while -m sets the modification date. The tool has been deprecated by Apple for years, but it still ships with the Command Line Tools, and no built-in replacement exposes the creation date as directly.
03Risk
!Warning: SetFile is officially deprecated and may disappear from future Xcode releases; treat scripts that rely on it as having an expiry date.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- SetFile — set file attributes on macOSEvidence: Documents the -d flag's MM/DD/[YY]YY [hh:mm[:ss]] format for the creation date.
Last verified: 2026-09-17 · Category: Files & Folders