Why do we install software via `.dmg` files? When I want to install software, I typically download a .dmg (Disk iMaGe) file. When I open it, this .dmg file looks like what I would call a "virtual disk" (hence its name I presume) and is listed in  Finder under devices. It is also listed in Disk Utility under Disk Images and it seems like it can be erased or unmounted just like any other disk.


What is the logic for which software needs to be installed with such a "virtual disk"?
Why doesn't it come as a simple binary file or I don't know what?
DMGs have a few key features which make them superior to plain old zips


They’re a full file system (meaning they can store file permissions, have custom folder backgrounds, etc)
They support “mandatory” EULAs before mounting which is nice for legal stuff
Provide a more reliable execution environment. If you have to do absolute path stuff for installation (which tbh you shouldn’t) you can prepare the DMG, mark it as read-only and use that to install


Really the key feature is that they support the full HFS+ filesystem. Zip (commonly, Linux versions sometimes support permissions) is stupid and only supports bundling files and folders and nothing else. No metadata, just the files.