Opened 3 years ago

Last modified 3 years ago

#7274 assigned enhancement

Make Mac distribution dmg file smaller using LZMA compression

Reported by: Tom Goddard Owned by: Tom Goddard
Priority: moderate Milestone:
Component: Platform Version:
Keywords: Cc: chimerax-programmers
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description (last modified by 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).

Change History (5)

comment:1 by Tom Goddard, 3 years ago

Description: modified (diff)

comment:2 by Tom Goddard, 3 years ago

Description: modified (diff)

comment:3 by Tom Goddard, 3 years ago

It looks like the Mac OS 10.14 downloads could be recognized from the web server. Here are example user agents we see in plato logs

macOS 10.13

137.205.238.185 - - [01/Jul/2022:08:35:09 -0700] "GET /css/chimera.css HTTP/1.1" 200 2083 "https://www.cgl.ucsf.edu/chimera/features.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15"

macOS 10.14

128.103.94.181 - - [01/Jul/2022:05:06:14 -0700] "GET /chimerax/docs/user/ChimeraX-docs-icon.svg HTTP/1.1" 200 9726 "https://www.cgl.ucsf.edu/chimerax/docs/user/commands/set.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15"

macOS 10.15

152.231.192.131 - - [01/Jul/2022:00:10:09 -0700] "GET /chimera/chimera16.png HTTP/1.1" 200 1228 "https://www.cgl.ucsf.edu/chimera/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"

macOS 11

54.160.234.227 - - [01/Jul/2022:00:13:26 -0700] "GET /chimera/ HTTP/1.1" 200 10402 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

macOS 12

20.120.185.52 - - [05/Jul/2022:20:30:18 -0700] "GET /Outreach/bmi280/slides/swc/lec/img/debugging/debugger_in_action.png HTTP/1.1" 200 54144 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"

Looking at how many Mac server log entries there are for each platform using the July 1-12 log (12 days)

wilkins$ cd /usr/local/www/logs/plato-httpd/rbvi-production
wilkins$ grep "Mac OS X 10_15" rbvi-production-ssl_access_log | wc

It appears that 10.14 is still about 5% of hits on our RBVI server.

Strange that there are so many 10_15. But my macOS 12.4 laptop reports as 10_15 in the plato sever log. So probably most Mac systems newer than 10_15 are reporting 10_15 instead of 11 or 12 since 11 and 12 are likely the majority of all Mac systems now.

26  Mac OS X 12 
103   Mac OS X 11
3310 Mac OS X 10_16
106307 Mac OS X 10_15
7274 Mac OS X 10_14
4667 Mac OS X 10_13
1031 Mac OS X 10_12
4151 Mac OS X 10_11
733 Mac OS X 10_10
267 Mac OS X 10_9
178 Mac OS X 10_8
26 Mac OS X 10_7
33 Mac OS X 10_6
7 Mac OS X 10_5
0 Mac OS X 10_4

comment:4 by Tom Goddard, 3 years ago

Universal builds could use this compression, ticket #7222.

comment:5 by Tom Goddard, 3 years ago

Added LZMA dmg compression (format ULMO) to Mac M1 technology preview build (ticket #4663) since that will only be used on macOS 11 and 12 where LZMA is available.

Note: See TracTickets for help on using tickets.