- Very compressible
- Not demanding on resources
- Only rarely used
$ cd /Developer
$ sudo hdiutil create -srcfolder "ADC Reference Library"
-format UDBZ DevLibrary.dmg
That will build the compressed reference library in the Developer folder. Once you are done, delete the "old" reference folder, and make an empty placeholder for later:
$ sudo rm -rf "ADC Reference Library"
$ mkdir "ADC Reference Library"
Note: I didn't sudo the mkdir command on purpose, to keep the following Folder Action from prompting me for a password just to open the Developer documentation.Now once you're done, you can attach to it using hdiutil:
$ hdiutil attach -mountpoint /Developer/ADC Reference Library
/Developer/DevLibrary.dmg
That's it! It's not a read/write volume, but that doesn't seem to be a problem. Be patient while it checksums the file on the first mount, it will go faster once everything checks out.
I also attached a folder action to the /Developer folder that mounts the volume automatically -- that way when I navigate to the Xcode app, it mounts the compressed image for me on the way. Open up Script Editor and cut and paste this code in (don't mind the sloppy code; I'm a script newbie...):
on opening folder this_folder
tell application "System Events"
if file "/Developer/ADC Reference Library/index.html" exists then
-- display dialog "it exists!" --used for testing
else
do shell script "hdiutil attach -mountpoint /Developer/ADC\ Reference\ Library/ /Developer/DevLibrary.dmg"
end if
end tell
end opening folderNote that the double backslashes are not typos; AppleScript requires them to handle the backslash properly. Save the script to wherever you want (stock Apple Folder Actions are located in /Library » Scripts » Folder Action Scripts). Control-click on the Developer folder and Enable Folder Actions if they aren't already. Control-click again, select Add Action, and navigate to the saved script above, and you should have an automatically mounting compressed reference library!
[robg adds: Geeklog ate all the backslashes in the original submission, but I think I've put them all back where they need to be -- as a gentle reminder, please use the [code] [/code] tag pair when including code (that will protect the backslashes), and include your email address if posting anonymously, so I can contact you with questions!]

