The pkgsrc distribution suggests (and offers tools for) making a fixed-size disk image for OS X and Darwin users. This not the best approach with OS X 10.4 and later.
The following command line incantation can create a resizable HFS+ disk image that is case-sensitive and will grow to fit what you need:
hdiutil create -fs HFSX -fsargs "-c c=64,a=16,e=16 -s" -volname pkgsrc -type SPARSE -stretch SizeOfYourDisk -size SizeOfYourDisk -ov /SomewhereOnYourDisk/pkgsrc
You can avoid silliness with your
PATH by adding symlinks:
ln -s /Volumes/pkgsrc/pkg /usr/pkg
ln -s /Volumes/pkgsrc/pkgsrc /usr/pkgsrc
ln -s /Volumes/pkgsrc/pkgdb /var/db/pkg
You can compact this image later to reclaim disk space with:
hdiutil compact /SomewhereOnYourDisk/pkgsrc.sparseimage
You can later use
hdiutil resize if you move it to a disk that is a different size. Mounting can also likely be automated to a large degree, maybe the lazyweb can chime in with ideas along those lines.
Update: Don’t, for the love of your files, put the disk image inside a FileVault home directory (or any other sparseimage disk image). I had to borrow a PowerPC Mac and buy a copy of DiskWarrior to get my files back. DiskWarrior apparently doesn’t work with ICBMs yet.