Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacBH928

macrumors G3
Original poster
May 17, 2008
8,738
3,895
So what I understand that .dmg is a virtual drive. When Windows downloads and install file and Linux magically installs its app around the system, MacOS always have a .dmg file that you have to mount then drag the App icon to Applications folder then eject the drive.

My question is why? Why is it not just a .Zip file with the application icon or just the Application icon itself?
 

Powermax

macrumors regular
Aug 11, 2006
231
195
The Application Icon is actually not an icon but a folder with several files inside which is displayed as an icon. You can take a look inside when you right-click the .app and choose "view package content". Thats why you need a container for it, because the .app is not a single file.
dmg is basically Apples version of a zip file but more powerful. The advantage is that it contains its own filesystem and therefore can be formatted as HFS+ or APFS, so the app can directly started from there which would not be possible with a zip file.
 

Nermal

Moderator
Staff member
Dec 7, 2002
21,015
4,592
New Zealand
I suspect some of it's for historical reasons too; I don't think native unzipping came along until OS 10.3 and by that time a lot of developers were already set in their ways.
 
  • Like
Reactions: bsamcash

bsamcash

macrumors 65816
Jul 31, 2008
1,033
2,623
San Jose, CA
I suspect some of it's for historical reasons too; I don't think native unzipping came along until OS 10.3 and by that time a lot of developers were already set in their ways.
Mostly this. Pretty much convention. But it does have benefits, such as virtually no resource cost like uncompressing would have, as well as being able to use the binaries or files from directly within the drive.
 

MacCheetah3

macrumors 68020
Nov 14, 2003
2,286
1,228
Central MN
I think, it’s about being intuitive. Because the DMG is a separate volume, the developer can organize/place files without consideration/worry of a user’s filesystem view preferences, add a background, and so forth to make it an app-like UI (e.g., “Drag here” pointing from the app to an alias for the Applications folder). You can’t get that UX by simply providing the app file.
 

MacBH928

macrumors G3
Original poster
May 17, 2008
8,738
3,895
The Application Icon is actually not an icon but a folder with several files inside which is displayed as an icon. You can take a look inside when you right-click the .app and choose "view package content". Thats why you need a container for it, because the .app is not a single file.
dmg is basically Apples version of a zip file but more powerful. The advantage is that it contains its own filesystem and therefore can be formatted as HFS+ or APFS, so the app can directly started from there which would not be possible with a zip file.

Ok but whats the benefit of running directly from the virtual drive? and why no one else is doing it?

Also, I understand the part about the app icon being a folder, what I don't understand is that once you drag and drop to Applications folder some how it is able to install files around your system. Mean while other apps still choose to have an installation dialogue with a progress bar like on Windows. I do not know whats the difference between the 2 methods.

I suspect some of it's for historical reasons too; I don't think native unzipping came along until OS 10.3 and by that time a lot of developers were already set in their ways.

Well, they could always download the plain .app can't they? Like Windows .exe? or is .exe a zipped/bundle file in the first place to begin with?
 

Stephen.R

Suspended
Nov 2, 2018
4,356
4,747
Thailand
Well, they could always download the plain .app can't they?
No. A "Foo.app" is just a directory of files, that macOS shows to you, as a single Application.

It has to be bundled somehow. It's not uncommon to use a zip, tar/gz or tar/bz2 archive these days for that purpose (particularly open source cross platform stuff).
 
  • Like
Reactions: hobowankenobi

MacBH928

macrumors G3
Original poster
May 17, 2008
8,738
3,895
No. A "Foo.app" is just a directory of files, that macOS shows to you, as a single Application.

It has to be bundled somehow. It's not uncommon to use a zip, tar/gz or tar/bz2 archive these days for that purpose (particularly open source cross platform stuff).

any reason why a folder/directory can not be downloaded just like an .mp3 file can be downloaded?
 

Toutou

macrumors 65816
Jan 6, 2015
1,082
1,575
Prague, Czech Republic
any reason why a folder/directory can not be downloaded just like an .mp3 file can be downloaded?
A file is just a large block of data and all operating systems think about it that way. You can read the file, byte by byte, you can send it somewhere, download it and read the same bytes. It's physical data.
Sending a file is like placing a picture into someone's hands.

A directory, on the other hand, the way it's represented in the filesystem, does not contain any real data, it's a list of instructions on where to find the files and what their names are. (Note that this is still very simplified AND different OSes store the lists differently, so we're talking about many layers of incompatibility.)
Sending a directory would be like telling someone that there's a bunch of pictures at your house in a drawer.

Okay, you say, so let's send the virtual list of filenames and locations, and then immediately send the actual physical files one by one. Right?
Right! That exactly what file archives like tar, zip, or dmg do. They contain a list of files with some metadata, and the actual file contents (sometimes even compressed to save space), and they provide a standardized way of recreating the files and directories inside them in the receiver's filesystem.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.