Skip to content

Instantly share code, notes, and snippets.

@mushfek
Forked from dixson3/workspace.sh
Created January 6, 2016 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mushfek/814992376b6cc43d1209 to your computer and use it in GitHub Desktop.
Save mushfek/814992376b6cc43d1209 to your computer and use it in GitHub Desktop.
Create and manage a case-sensitive disk-image on OSX. This is great when you have a need to work with case-sensitive repos on a mac.
#!/bin/bash
# where to store the sparse-image
WORKSPACE=~/Documents/workspace.dmg.sparseimage
create() {
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 60g -volname workspace ${WORKSPACE}
}
detach() {
m=$(hdiutil info | grep "/Volumes/workspace" | cut -f1)
if [ ! -z "$m" ]; then
hdiutil detach $m
fi
}
attach() {
hdiutil attach ${WORKSPACE}
}
compact() {
detach
hdiutil compact ${WORKSPACE} -batteryallowed
attach
}
case "$1" in
create) create;;
attach) attach;;
detach) detach;;
compact) compact;;
*) ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment