﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	notify_on_close	platform	project
7274	Make Mac distribution dmg file smaller using LZMA compression	Tom Goddard	Tom Goddard	"Zach observed that the Mac distribution dmg file (.dmg) can be made much smaller (60% of dmg size) using instead an LZMA compressed tar file (.tar.xz made with tar -cfJ), ticket #7250 comment 13.  This would reduce our 400 Mbyte Mac distribution to about 240 Mbytes.

The dmg format supports LZMA compression but only from macOS 10.15 onward, and testing it gave dmg size that was 70% of the current dmg (which uses zlib level 1 compression).  But we currently distribute on macOS 10.14.  I tested on our macOS 10.14 build machine essex.cgl.ucsf.edu and the LZMA compressed dmg indeed fails to mount (error is ""corrupted file"", using command ""hdiutil attach cx1.4_lzma.dmg"").

This does not seem like a good enough reason to drop 10.14 support.  We could provide two dmg files one for 10.14 and one for 10.15 and later.  We'd want the download page to only show the appropriate file.  That can only work if the user agent identified by the web browser on 10.14 identifies the OS vesion as 10.14.  Have to check if it does.

Making the distribution file size 70% of current size would offset somewhat the size increase in going from a Mac Intel dmg to a Mac Universal (ARM + Intel) dmg which increases the size to 156% of current size (ticket #7222), making the universal dmg only 10% bigger than the current Intel-only distribution.

The hdiutil Mac command that makes dmg files offers 5 compression formats but LZMA looks most promising.  Here are sizes for theh different formats

{{{
241M	cx1.4.tar.xz                 (not a dmg, 60% of default size)		 
281M	cx1.4_lzma.dmg	    (macos 10.15 or later, 70% of default size)
324M	cx1.4_bzip2.dmg	    (deprecated in macOS 12, 85% of default size)
352M	cx1.4_lzfse.dmg	                                            
359M	cx1.4_zlib9.dmg	    (90% of default size)
400M	cx1.4.tar.gz
403M	cx1.4_zlib.dmg	    (default)
442M	cx1.4_adc.dmg
1.2G	        cx1.4.tar
}}}

Commands for making LZMA file and tar.xz file are

{{{
/usr/bin/hdiutil create cx1.4_lzma.dmg -srcfolder ~/Desktop/ChimeraX-1.4.app -volname ChimeraXInstaller -fs HFS+ -format ULMO

tar -cJf cx1.4.tar.xz ~/Desktop/ChimeraX-1.4.app
}}}

It is a little surprising that the dmg LZMA reduces file size to 70% while tar LZMA reduces to 60%.  The Mac LZMA uses compression level 6 the same as tar.  Compression levels go from 0 to 9 but Mac OS only offers level 6 (https://openradar.appspot.com/FB8739821 and https://developer.apple.com/documentation/compression/compression_lzma).
"	enhancement	assigned	moderate		Platform				chimerax-programmers				all	ChimeraX
