6

There are a lots of question teaching how to create a DMG file from Linux. But none of them is clear about how to add compression to it.

I usually create a DMG package to redistribute to MacOS, but I would like to add compression as Apple specifies.

Did anyone have a chance to try a tool that supports compression during DMG packing?

Similar questions without compression:

jcfaracco
  • 853
  • 2
  • 6
  • 21
  • see answer from 'uckelman' at https://stackoverflow.com/questions/286419/how-to-build-a-dmg-mac-os-x-file-on-a-non-mac-platform – Valerio Feb 24 '21 at 15:25

2 Answers2

1

It depends. Here is a good analysis of the .dmg format. From that document, the compression is specified for each block chunk:

Table: DMG blxx types
Type    Scheme  Meaning
0x00000000  --- Zero-Fill
0x00000001  UDRW/UDRO   RAW or NULL compression (uncompressed)
0x00000002  --- Ignored/unknown
0x80000004  UDCO    Apple Data Compression (ADC)
0x80000005  UDZO    zLib data compression
0x80000006  UDBZ    bz2lib data compression
0x7ffffffe  --- No blocks - Comment: +beg and +end
0xffffffff  --- No blocks - Identifies last blxx entry
Mark Adler
  • 101,978
  • 13
  • 118
  • 158
0

To convert the gist of @Valerio's comment into a proper answer so nobody else misses it like I almost did:

According to this answer by @uckelman:

  1. instal libdmg-hfsplus
  2. Run dmg uncompressed.dmg compressed.dmg
ssokolow
  • 14,938
  • 7
  • 52
  • 57