Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any added files or folders in /var/run they are deleted when I restart my machine. Why is this happening? What should I do to ensure these files are not deleted (or are recreated) and how would I go about doing this?

Any help appreciated

share|improve this question
up vote 5 down vote accepted

/var/run is mounted as tmpfs. That means it's totally empty when your machine boots and it's meant to be like this to prevent stuff like daemons not starting because of a left-over PID-file. Startup scripts usually create the directories they need in there before using them. If you want to store a PID-file either put it in /var/run directly or create a directory before creating the PID-file. This is no place to store data that needs to remain there across reboots.

share|improve this answer
Hi Ismooth, thanks for your answer. I am using it to store a PID-file, but the directory I create within the /var/run directory is deleted whenever I restart my mac. Is there a way of ensuring this folder is not removed or is recreated on startup? – simpleengine Feb 21 '13 at 1:00
@simpleengine Either don't create a directory at all, or re-create it at startup. – Michael Hampton Feb 21 '13 at 1:37
I'm not familiar with Mac, but there must be some documentatinon on how to handle such a situation. Or trawl through the configuration of other daemons to pilfer the way of doing it from there. – vonbrand Feb 21 '13 at 3:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.