BSD systems have utime(3) which (among other things) allows changing the "Birth time", aka btime (as compared to atime, mtime or ctime), of files. But, the man page also indicates utime(3) is obsoleted by utimes(2).

I know I can view the btime value using stat:

stat -f %B <file>

Unfortunately, it doesn't seem that touch(1) implements manipulation of btime. Man pages on my Mac include an entry for utime(3) in the C library which can manipulate btime, but I'm not seeing anything that provides an in-built interface to utime(3)'s btime manipulation.

Another hint that occurred to me: When I drag photos out of the Mac application "Photos", it creates new files. (The original files remain in their location where Photos keeps them organized, so I'm certain this is a new file copied from the original.) These new files have Created dates (what I see in finder listings or the get info, which display the btime value for the file) which match when the photos were taken -- generally several years in the past. So clearly it is possible to set btime.

  • There is no utime(2) on macOS, and the utime(3) manual does not indicate that one is able to set the birth time of a file, as far as I can see.
    – Kusalananda
    Commented May 14, 2017 at 12:43
  • It's utimes(2) but still no option to fiddle with the creation time.
    – thrig
    Commented May 14, 2017 at 14:36
  • man sections update in Q Commented May 14, 2017 at 16:03
  • I'm going to post in the ThinkDifferent stack's meta-stack to see if that community might be better... Commented May 15, 2017 at 13:46
  • @CraigConstantine Cross-posting is discouraged. Either delete this question and post it there instead, or request that it is migrated.
    – Kusalananda
    Commented May 15, 2017 at 13:48

1 Answer 1


One way to solve this (this solves my problem) is to use Apple's SetFile(1) command which allows manipulation of file attributes. It takes a -d arg to manipulate creation date and a -m arg for manipulating modification time. Helpfully, if I set the modification time to before the current creation date, it sets the creation date too.

$ SetFile -m 05/14/200 foofile.jpg

This Q on the Apple/Think Different stack has this info https://apple.stackexchange.com/questions/49154/how-to-change-the-creation-st-birthtime-date-time-of-a-file-in-lion

  • 1
    Doesn't touch with the t option do the same thing?
    – fd0
    Commented May 15, 2017 at 14:16
  • why, yes! yes it does... well, that was a detour o_O Commented May 15, 2017 at 18:41
  • 3
    @fd0 touch sets the mtime and the atime, not the birth time. Commented May 15, 2017 at 22:10
  • on Mac Sierra at least, it also sets teh file btime, if you -t it into the past. I had originally read that -t didn't manip btime, so I went on the long detour of finding SetFile from the dev tools. Turns out touch(1) does what I need. (apparently touch -t won't set btime out into the future though i've not tried it) Commented May 16, 2017 at 10:19
  • Craig, a reminder to accept your self-answer ;) . Thanks for doing the research!
    – cxw
    Commented Mar 6, 2019 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .