Monday, December 3, 2012

Mac Disk Image Development with Git


* I copied and edited these notes from: AOSP

Git Development on Mac

In a default installation, OS X runs on a case-preserving but case-insensitive filesystem. This type of filesystem is not supported by GIT and will cause some git commands (such as "git status") to behave abnormally. Because of this, you should always work with the GIT source files on a case-sensitive filesystem. This can be done fairly easily using a disk image, discussed below.

Creating a case-sensitive disk image

You can create a case-sensitive filesystem within your existing OS X environment using a disk image. To create the image, launch Disk Utility and select "New Image".  Using sparse images saves space while allowing to grow later as the need arises. Be sure to select "case sensitive, journaled" as the volume format.
You can also create it from a shell with the following command:

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

This will create a .dmg (or possibly a .dmg.sparsefile) file which, once mounted, acts as a drive with the required formatting for GIT development. For a disk image named "mydisk.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountMydisk"

# mount the file image
function mountMydisk { hdiutil attach ~/mydisk.dmg -mountpoint /Volumes/mydisk; }

Once mounted, you'll do all your work in the "mydisk" volume. You can eject it (unmount it) just like you would with an external drive.

Setting a file descriptor limit

On MacOS the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit.
To increase the cap, add the following lines to your ~/.bash_profile:

# set the number of open files to be 1024
ulimit -S -n 1024


No comments:

Post a Comment