Skip to content

Instantly share code, notes, and snippets.

@saantiaguilera
Created October 31, 2019 00:03
Show Gist options
  • Save saantiaguilera/877cd7c7c48690f2330cb769e6f14a50 to your computer and use it in GitHub Desktop.
Save saantiaguilera/877cd7c7c48690f2330cb769e6f14a50 to your computer and use it in GitHub Desktop.
Volume manager for abstracting code sources
# Add this in your .zshrc or .bash_profile or wherever you want
mount() {
# Note that I save all my sparse images in ~/Projects/
hdiutil attach ~/Projects/$1.dmg.sparseimage -mountpoint /Volumes/$1
}
unmount() {
hdiutil detach /Volumes/$1
}
createSparseImage() {
# 40g as max for sparse increment of the image. Tune it if you want more or less
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/Projects/$1.dmg
}
@saantiaguilera
Copy link
Author

Usage:

# Create an image where we will store all work related backend source codes
createSparseImage work-backend-repos

# Mount the image on disk, use the code inside normally
mount work-backend-repos

# When you stopped using it, unmount from a finder 'eject' or like this:
unmount work-backend-repos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment