Skip to content

Instantly share code, notes, and snippets.

@niklasdewally
Created July 25, 2023 11:56
Show Gist options
  • Select an option

  • Save niklasdewally/2128525ab082ba725452f47e94da0420 to your computer and use it in GitHub Desktop.

Select an option

Save niklasdewally/2128525ab082ba725452f47e94da0420 to your computer and use it in GitHub Desktop.
Mac Automount with sshfs
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.mount-<name></string>
<key>ProgramArguments</key>
<array>
<string>PATH TO SERVICE SCRIPT</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
#!/bin/sh
MOUNT_LOCATION=/Users/niklas/mnt/storage
SSH_CONFIG=/Users/niklas/.ssh/config
[email protected]:
VOLNAME="My storage box"
mkdir -p MOUNT_LOCATION
# -f = run in foreground. Allows launchd to know when this process crashes, so it can start a new one.
/usr/local/bin/sshfs "$SERVER" "$MOUNT_LOCATION" -f -F "$SSH_CONFIG" -oauto_cache,reconnect,local,volname="$VOLNAME",allow_other,defer_permissions,noappledouble
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment