__ ___ __ ___ __ _____ __ _______
/ |/ /___ ______/ |/ /___ __ ______ / /_/ ___// |/ / __ )
/ /|_/ / __ `/ ___/ /|_/ / __ \/ / / / __ \/ __/\__ \/ /|_/ / __ |
/ / / / /_/ / /__/ / / / /_/ / /_/ / / / / /_ ___/ / / / / /_/ /
/_/ /_/\__,_/\___/_/ /_/\____/\__,_/_/ /_/\__//____/_/ /_/_____/
Automatically reconnect SMB shares on macOS. No friction. Just works.
Keep SMB drives mounted across sleep, Wi-Fi changes, and VPN reconnects.
Designed for developers who are tired of reconnecting SMB shares manually.
No sudo. No system daemons. Fully reversible.
Full install and clean uninstall flow in seconds:
If you've worked with SMB on macOS, you’ve probably seen this:
- Sleep → mount disappears
- Wi-Fi changes → disconnected
- VPN connects → gone again
Now you're back to manually reconnecting instead of working.
MacMountSMB fixes that.
This is one of those problems that shouldn't exist - but does.
MacMountSMB runs a lightweight background check in your user session:
- Uses
launchdthrough a LaunchAgent - Checks whether your SMB share is mounted
- Reconnects only if needed
- Uses macOS native SMB handling through
open "smb://..."
No hacks. No credential handling. No system changes.
- User-scope only, with no sudo and no system daemons
- Smart reconnect triggered only when the share is missing
- Native macOS integration through Finder and Keychain
- Interactive and flag-based installation
- Clean uninstall with no leftover generated artifacts
- Logs and debug support
- Built-in status command for config, run history, and scheduling insights
./install.shIf required values are missing, the installer will prompt for them.
./install.shYou will be prompted for:
- SMB server or IP
- SMB share name
- LaunchAgent label
- Check interval
- Whether to auto-load the LaunchAgent
- Whether to overwrite existing generated files
./install.sh \
--server SERVER_OR_IP \
--share SHARE_NAME \
--label com.example.mountsmb \
--interval 300 \
--load \
--forceUsing an SMB URL shortcut:
./install.sh --smb-url "smb://SERVER/SHARE" --label com.example.mountsmb --interval 300 --load--server <server-or-ip>--share <share-name>--label <launchd-label>--interval <seconds>--smb-url <smb://server/share>--load--force--help
install.shcollects values either interactively or through flags- It generates a runtime script and a LaunchAgent plist
- The LaunchAgent runs on load and at the chosen interval
- The runtime script checks current mounts
- If the share is missing, it runs
open "smb://..."to reconnect it
If you pass --load, or choose it during interactive setup, the installer attempts:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/<label>.plistIf you install without loading it immediately, the installer prints the exact command to run manually.
Generated runtime files are installed in user-safe locations:
- Runtime script:
~/Library/Application Support/mountsmb/mountsmb-<label>.sh - LaunchAgent plist:
~/Library/LaunchAgents/<label>.plist - Logs:
~/Library/Application Support/mountsmb/logs/<label>.out.log~/Library/Application Support/mountsmb/logs/<label>.err.log
./status.sh --list
./status.sh --label com.example.mountsmbThe status command can either list deployments or inspect one specific label. It shows:
- Existing deployments, including labels, shares, intervals, and last results
- Current configured server/share and paths
- Whether the LaunchAgent appears loaded
- Last recorded run result and details
- Total recorded run count
- Estimated next run time based on the configured interval
- Recent stdout/stderr log output
If you omit --label, the most recently installed label is used.
./uninstall.sh --label com.example.mountsmbOr force:
./uninstall.sh --label com.example.mountsmb --force✔ Removes LaunchAgent
✔ Removes scripts
✔ Removes logs
✔ Cleans everything
- macOS with
launchdandlaunchctl - SMB share reachable from your machine
- Access to
~/Library/LaunchAgents
- No credential storage in repo
- Uses macOS Keychain
- Runs in user space only
- No sudo required
- No system changes
launchctl print gui/$(id -u)/<label>
launchctl kickstart -k gui/$(id -u)/<label>
cat "$HOME/Library/Application Support/mountsmb/logs/<label>.out.log"
cat "$HOME/Library/Application Support/mountsmb/logs/<label>.err.log"- Multiple shares (one agent per share)
- Custom intervals
- Template-based workflows
- Manual LaunchAgent control
Found an edge case? Something not working as expected?
Open an issue or drop feedback - this tool is built for real-world usage.
MIT. See LICENSE.
