Skip to content

Instantly share code, notes, and snippets.

@sirlancelot
Created January 25, 2010 23:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sirlancelot/286375 to your computer and use it in GitHub Desktop.
Save sirlancelot/286375 to your computer and use it in GitHub Desktop.
Script that can be used during Mac OS X startup to mount a disk image to any path on the filesystem.
#!/bin/sh
##
# Mount my development websites folder
#
# NOTE: Because this uses Mac OS X mounting techniques, all mac format
# images are supported and many other UNIX filesystem formats.
# (My Development Sites image is stored encrypted.)
# Location of the image to be mounted
IMAGE="$HOME/Documents/Development Sites.sparsebundle"
# Path to an empty folder where the contents of the image can be found
MOUNT="$HOME/Sites"
# Do the magic
# -owners on = Honor file/folder permissions in image
# -nobrowse = Don't show in Finder (-mountpoint is still visible)
# -mountpoint = Attach to a folder.
hdiutil attach -owners on -nobrowse -mountpoint "$MOUNT" "$IMAGE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment