I’ve been in the habit of saving scratch files in /tmp
on my Mac. It’s fast, it’s disposable, and it keeps clutter out of my working directories. For temporary stuff, it makes a lot of sense.
But I’ve lost files this way. After a reboot. After a macOS update. And now, once again, after just a normal day of use.
I didn’t reboot. I didn’t run a system cleaner. But the file I thought was there is now gone. Maybe I saved it somewhere else. Maybe I’m misremembering. But if I did leave it in /tmp
, then I should’ve known better.
There’s no guarantee how long things stay in /tmp
, even if you don’t restart. macOS can and will clean it up when it feels like it.
Note to self: just make a ~/scratch
directory and use that. Add it to .gitignore
, exclude it from backups, do whatever you need to keep it feeling “temporary.” But don’t put anything in /tmp
if there’s even a tiny chance you might want it later.