Home > bashism, software > Case Sensitivity on MacOSX

Case Sensitivity on MacOSX

The files system HFS+ on a MAC is kind of crooked when it comes to case sensitivity (Wikipedia: HFS+). In case you come across a piece of software that relies on case sensitivity beeing there you can use a (sparse) volume formatted with case sensitivity to get the job done. Lets use a generic name 😉

NAME=scorep

First, create the volume, mount it and save the UUID so you recognize the volume later:

hdiutil create -volname ${NAME} -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/${NAME}.dmg
hdiutil attach ~/${NAME}.dmg.sparseimage -mountpoint /Volumes/${NAME}
diskutil info /Volumes/${NAME} | grep UUID | awk '{ print $3 }' > ~/.${NAME}voluuid

To automatically mount the volume in case it is not mounted whenever you open a shell, add the following to your ~/.bash_profile:

TMPUUID=`cat ~/.${NAME}voluuid`
MNTPNT=`diskutil info ${TMPUUID} | grep "Mount Point" | awk '{ print $3 }'`
if [ "$MNTPNT" = "" ]; then hdiutil attach ~/${NAME}.dmg.sparseimage -mountpoint /Volumes/${NAME}; fi

Cheers,
Willi

Categories: bashism, software Tags:
  1. No comments yet.
  1. No trackbacks yet.