Fix files creation date in macOS
By Flavio Copes
Learn how to fix the creation date of files in macOS using the SetFile -d command, handy for GoPro videos or photos that ended up with the wrong date.
To fix the creation date of files in macOS, use the SetFile -d command in the terminal. It rewrites the creation date that Finder and Photos read, which the usual touch command can’t do.
Here’s why I needed it. I took some videos with a GoPro that didn’t have date/time set correctly, so all videos were dated 2016 or so. Every photo app sorted them at the wrong end of the timeline.
I went into the folder that had those videos and used the command
SetFile -d '01/25/2025' *
to update all files to the correct date.
The * applies the change to every file in the folder, which is exactly what I wanted for a batch of videos. Pass a single filename instead if you only need to fix one file.
This won’t affect the time.
If you also want to set the time, use this format:
SetFile -d '01/25/2025 12:00:00' *
Watch the date format
The date is in US format: month first, then day, then year.
01/25/2025 is January 25. If you’re used to writing the day first, it’s easy to type 25/01/2025 and get an error, or worse, silently set the wrong date when both numbers are 12 or below. Double check before running it on a whole folder.
Checking the result
GetFileInfo shows the creation date of a file, so you can verify the change worked:
GetFileInfo -d GOPR0042.MP4
# 01/25/2025 12:00:00
Where SetFile comes from
SetFile is not installed on a fresh macOS. It ships with the Xcode Command Line Tools.
If the terminal says command not found, install them first:
xcode-select --install
Apple marks SetFile as a legacy tool, but it still works fine, and I haven’t found a built-in replacement for changing creation dates.
One last note: SetFile -d only changes the creation date. If you also want to change the modification date, that’s a separate flag, -m, with the same date format. And if you only need the modification date, the standard touch -t command handles that without Xcode tools, but it can’t touch the creation date, which is the one photo apps care about.
Related posts about mac: