When does macOS send the ATA TRIM command to the SSD's controller?

  • After deleting a file? Like Windows 10 does.
  • After a fixed amount of time? Like Ubuntu and Fedora do, once a week.

I'm assuming macOS Monterey and an Apple SSD.

1 Answer 1


It is issued after deleting a file (technically it is a bit more complicated involving vnodes and ensuring that no other process has the same file opened).

  • Thanks! Did you learn that from resources like macOS documentation? Because I couldn't find any official information about this topic. Nov 15, 2021 at 6:11
  • 1
    I do not think that any publically available macOS documentation has this information, I'm afraid. You can download the source code for the XNU kernel, and there you can find the source code for functions that perform the TRIM itself (note that the ioctl refers to "unmap" here instead of "trim" as it based on the SCSI version). The functions that trigger the TRIM exists in the code for vm paging (swap), vnodes (virtual file systems) and in IOKit. It is perhaps easiest to validate experimentally.
    – jksoegaard
    Nov 15, 2021 at 9:08

You must log in to answer this question.

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