Mac OS HFS+ case-insensitivenesss screws SVN
So I work on OS X for a few years now, but until today that I didn’t really care about the underlying HFS+ file system.
But while working on a project using SVN, I got this unexpected error message:
gianpaolo-del-mattos-macbook-pro:trunk Gianpaolo$ svn update
svn: URL 'svn+ssh://...../webinterface/files/lib/webmin' of existing directory '...../webinterface/files/lib/Webmin' does not match expected URL 'svn+ssh://..../webinterface/files/lib/Webmin'
What had happened? Looking into the repository I found two folders, one by the name of ‘webmin’ and the other being ‘Webmin’.
Googl’ing for the error message I found references to SVN on Windows, having issues checking out folders by the same name onto a case-insensitive NTFS.
I though OS X would be case-sensitive, it’s basically UNIXish in it’s core, right? WRONG.
For historical reasons, OS X uses HFS+ with case-sensitivity disabled by default. Thus folders ‘webmin’ and ‘Webmin’ or even ‘webmiN’ are the same.
Test this on your own. Fire up a terminal and create a folder called ‘Test’.
Now try to enter it using the name of ‘TESt’:
You’ll notice that it indeed works. HFS+ default settings are case-preserving, but nevertheless case-insensitive.
Solution? One possible work-around would be to REFORMAT the whole disk using HFS+ with case-sensitivity enabled, which would require a complete reinstall of OS X. There’s some issues with this, though. Various sources report, that some applications may not work properly on case-sensitive HFS+ volumes.
So, a more versatile, but albeit complicated, work-around would be to create virtual disk image and use this to store case-sensitive content.
For this you need to start “Disk Utility”. Although my screenshot is in german language, you should get the point easily.
- Create a new disk image and give it some memorizable name (I used ‘CaseSensitive’ in the example) and store it in any folder you like
- Give it some practical size depending on your need
- Use HFS+ with journaling and case-sensitiveness as file system
- Make sure you create this as a writable image
This will create a new disk image by the name of ‘CaseSensitive.dmg’. It should get mounted automatically. If not, just double-clicking should do so.
Now you can move all your content to the Disk Image. When it’s mounted, you can access it’s path through ‘/Volumes/CaseSensitive’ (the name in fact depending on the image name you chose earlier).
For me, this fixed the afore-mentioned SVN issue, as I could now properly checkout my repository and have the case-sensitive folders co-exist beneath each other.