Home » Android » macos – Move Android source into case-sensitive image

macos – Move Android source into case-sensitive image

Posted by: admin June 15, 2020 Leave a comment


I have downloaded the Android source to my Mac. When I went to build, I got this message:

$make -j4
Checking build tools versions…
build/core/main.mk:90: ************************************************************
build/core/main.mk:91: You are building on a case-insensitive filesystem.
build/core/main.mk:92: Please move your source tree to a case-sensitive filesystem.
build/core/main.mk:93: ************************************************************
build/core/main.mk:94: *** Case-insensitive filesystems not supported. Stop.

Then I realised I had missed creating a case-sensitive image. So I created a new one as mentioned on http://source.android.com/source/initializing.html, like this:

hdiutil create -type SPARSE -fs ‘Case-sensitive Journaled HFS+’ -size 40g ~/android.dmg

…but I can not create any folder in it, it says:

mkdir android
mkdir: android: Read-only file system

How can I move Android source code which was downloaded on my Mac OS to a newly created case-sensitive image?

How to&Answers:

I met the same problem. I found if you use sudo then the problem is gone.

Note the # character in Google’s step by step guide:

# hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg

function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }

So you have to run the commands with sudo:

sudo hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg
sudo hdiutil attach ~/android.dmg -mountpoint /Volumes/android


With the given command:

hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg

We’ll get a read-only sparse disk image file. Thus we need to convert it to writable before mounting it:

hdiutil convert ~/android.dmg.sparsefile -format UDRW -o ~/android.dmg

Besides, instead create & convert images, we can generate writable disk image directly with OSX build-in Disk Utility.


As of macOS High Seirra, there’s a faster alternative called “APFS Subvolumes”. It’s significantly faster than sparse images, and also features some fancy copy-on-write features like BTRFS.

  1. Open Applications → Utilities → Disk Utility
  2. Click the View button and change to “Show All Devices”
  3. Select the desired container disk and click the add button at the top of screen
  4. Select the new partition and name it e.g. “android”
  5. Choose “APFS (Case-sensitive)” from the Format menu
  6. Optionally click “Size Options” to set quota for the subvolume
  7. Click “Add” to create the volume

You should now have an extremely fast, case-sensitive partition that grows dynamically like a sparse image.


This was changed in Mojave.

This command will create the image getting ready to build.

hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 100g ~/android.dmg

This command will convert it. Change “administrator” with your username.

hdiutil convert /Users/administrator/android.dmg.sparseimage -format UDRW -o /Users/administrator/android.dmg