
Now launchd will run your shell script every 60 seconds, and if not mounted and available, will mount your sparsebundle disk image. Now load your launch daemon: launchctl load -w ~/Library/LaunchAgents/.plistĪnd that should do it. We're using launchd instead of cron for a host of reasons, the most important being access to your keychain. Create a file in ~/Library/LaunchAgents/ like ~/Library/LaunchAgents/.plist and put the following code in it, replacing, of course, the paths with your own paths: In any case, now we have to get it to run. This is a bit verbose, but means no storing passwords anywhere but keychain. automount works by reading the auto.master(5)map and sets up mount points for each entry in the master map allowing them to be automatically mounted when accessed. Printf $MOUNT_PASSWORD | hdiutil attach -stdinpass -mountpoint "$SPARSEBUNDLE_MOUNT_PATH" "$SPARSEBUNDLE_PATH" The automount program is used to manage mount points for autofs, the inlined Linux automounter. MOUNT_PASSWORD=$(security find-generic-password -w -D "disk image password" -l TimeMachine.sparsebundle) # to get the password from the keychain store # The mount command uses security find-generic-password If thenĮcho "Virtual drive not found on physical drive"

SPARSEBUNDLE_MOUNT_PATH="/Volumes/Time Machine/" Then create a file called mounter in your local bin directory ~/bin that contains the following code (replace all paths with your paths, and in the security find-generic-password, use the name of the key in Keychain): #!/usr/bin/env bash -e
#Macfusion automount how to#
If not, modify accordingly.įirst, follow the instructions in the link below to figure out how to use security find-generic-password to grab the password to your encrypted drive out of your Keychain programmatically. These instructions assume you're using a sparsebundle file in 10.9 because you use an encrypted drive.
