Keep Drives Mounted on macOS
2 min read • 383 words
The annoyance
I have a Mac mini in a closet acting as a household NAS. My laptop mounts its shares — Media, elzee, Backups Archive III, admin — and relies on them being there.
macOS does not really care if they are. Sleep, a network blip, a DHCP renewal, a moment of Wi-Fi confusion, and the volumes silently unmount. No notification, no reconnect, just gone until I click around in Finder.
The fix (someone else's, mostly)
Years ago I found Michael Scaramozzino's DLI_ReMounter — a tiny stay-open AppleScript applet that ticks every N seconds, checks whether a configured volume is mounted, and remounts it if not.
It is a good piece of software. It just needed two changes to be useful to me long-term:
- Multiple volumes. The original handles one share at a time.
- External config. The volume names and server name were edited directly into the script. Anyone I shared it with would have to crack open Script Editor and edit JavaScript.
The version I'm shipping
I forked it, kept Michael's attribution intact, and made two changes:
volumesis now an array of{ name, serverName }objects.- All config moves out of the script into
~/.config/keep-drives-mounted/config.json. The compiled applet is identical for everyone; their config is separate.
Repo: github.com/lzilioli/keep-drives-mounted.
The whole thing is one ~120-line JXA file, a config example, and a README. Setup is osacompile, drop a JSON file into place, add it to login items.
There is also a code block in the README labeled "Setup (give this to Claude)" — a self-contained prompt you can paste into Claude Code on a new Mac. It will ask you for your server and volume names, build the config, compile the app, and walk you through the system permission grant. I am increasingly fond of shipping a Claude prompt next to the README. It costs nothing, and for a one-off setup it is faster than reading the manual steps.
Why bother writing this up
It is a small thing. But "macOS quietly drops your network mounts" has been a paper cut for fifteen years and the answer is still a hand-rolled script. If you have the same setup, save yourself the afternoon I spent on this in 2018 and just clone the repo.