A generic shell script for creating an automagically mountable case sensitive volume in OSX.
Sourced originally from a former colleague, but I've adapted this solution for a wider range of practical install scenarios.
Primarily to resolve this conflict:
- OSX uses case-insensitive volumes (and actually warns you not to use case-sensitive volumes for system files.) Production systems almost always use case-sensitive file systems (think Linux). Shuffling your code between these environments creates the possibility of a filename collision.
- TimeMachine insists that you be consistent for all your disks, and choose one type of case sensitivity. As OSX recommends case-sensitive volumes, it makes sense to stick with this. Unfortunately this is at odds with condition 1.
Pump-Up-The-Volume allows you to create a TimeMachine-friendly development volume that will be compatible with your prod environment. It will act as a transparent case-sensitive folder, and TimeMachine will archive the sparsebundle allowing you to roll back if you need to.
You'll need to set a couple of important environment variables:
- WORKSPACE -- The location of the raw image file that will contain the case-sensitive file system.
- MOUNTPOINT -- The location where the image file will be mounted.
- VOLUME_NAME -- The name of the volume itself (how OSX will present it.)
- VOLUME_SIZE -- The size of the volume.
- AUTOMOUNT -- The location to install the automount script that will be executed on system start. (A script to mount and unmount the volume will be installed at this location.)
Note: Use sudo -E
to ensure the variables are passed to the sudo environment.
export WORKSPACE="/Volumes/Projects/.workspace.sparseimage"
export MOUNTPOINT="${HOME}/workspace"
export VOLUME_NAME="workspace"
export VOLUME_SIZE="10g"
export AUTOMOUNT="${HOME}/bin"
sudo -E ./inflate.sh install
Your volume will now be attached each time you boot up your machine.
If you find you need to occasionally unmount the volume, a unpump.sh
script will be installed at the AUTOMOUNT
location to facilitate this use case.