Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@saantiaguilera saantiaguilera commented Oct 31, 2019

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