I forgot to format my Mac to case-sensitive – this way I solved it

I have a new job, and a new computer, and I have to admit: when I moved to this machine, I was not able to resist the temptation of Catalina, so I installed the newest OSX on the laptop.

Everything was quite nice – well, I could rant for a while about why it was important to drop 32bit compatibility, but eventually solved everything there – but there a major problem emerged: when I checked out a repo of ours, I’ve got the following message:

$ git clone git@gwhatever.it.is:our/repo.git
Cloning into 'repo'...
remote: Counting objects: 20310, done.
remote: Compressing objects: 100% (295/295), done.
remote: Total 20310 (delta 254), reused 536 (delta 209)
Receiving objects: 100% (20310/20310), 280.39 MiB | 2.38 MiB/s, done.
Resolving deltas: 100% (12614/12614), done.
Updating files: 100% (1849/1849), done.
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'src/path/Configfile-1.0.cfg'
  'src/path/configfile-1.0.cfg'

Oh gosh. I have to reformat my disk, and start everything over. Maybe I can create a Time Machine backup, and restore everything? I just don’t feel like it.

Some people tend to have the same mistakes again and again, and it seems I am one of those, but this time, I decided to fight back.

Ok, so what can I do? I can create a new disk image, format it to case sensitive, mount it, and use it as a ‘project’ folder.

$ hdiutil create -size 10g -fs "Case-sensitive Journaled HFS+" -type SPARSE -volname Projects ~/Projects.dmg
$ hdiutil attach ~/Projects.dmg.sparseimage
$ sudo setfile -a V /Volumes/Projects/
$ killall Finder
$ mkdir /Volumes/Projects/projects/
$ ln -s /Volumes/Projects/projects/ ~/projects

So let’s see what is happened here?

  • I created a new disk image with case sensitive filesystem. The type is ‘spare’ which means it will automatically grow when needed, but initially it will take only 50mb on disk.
  • I mounted the image
  • I hide it on the desktop (This volume will be always mounted, so I don’t want to see the icon of it) – for this I set the invisible attibute with setfile, and restarted Finder
  • And finally I created the projects folder inside the volume, and linked it into my home directory.

That’s all folks. For more convenience I added the volume into my login items, so the disk image is automatically mounted when I restart my computer.

$ git clone git@gwhatever.it.is:our/repo.git
Cloning into 'repo'...
remote: Counting objects: 20310, done.
remote: Compressing objects: 100% (295/295), done.
remote: Total 20310 (delta 254), reused 536 (delta 209)
Receiving objects: 100% (20310/20310), 280.39 MiB | 2.38 MiB/s, done.
Resolving deltas: 100% (12614/12614), done.
Updating files: 100% (1849/1849), done.
$