DMG v/s PKG

Sonam2021
New Contributor III

Hi all,

 

Which application format is better DMG or PKG ? Can anyone provide more details 

I understand to add scripts in application - PKG is best and for indexing DMG 

PKG installs for all users in home directory 

 

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

I prefer PKG format because it's native to the OS and is more portable. The thing about the DMG format used with Jamf Pro is that it's proprietary. You can't just hand it to someone to use it for installation or use it in any other deployment scenario, at least not if it has any type of complexity contained within it. Pkgs usually will work with other installation methods outside of Jamf Pro as mentioned above.

Also, @jcarr said:

if you want to include a ReadMe or user guide on the desktop for each user on the system, you'll need to use a DMG.


Technically true, but with the right scripting know-how, for simple items like placing a document on every user's Desktop, it's possible to do with a PKG format and a postinstall script.

View solution in original post

7 REPLIES 7

Tangentism
Contributor II

I dont think you've quite understood the benefits/uses of each format.

Both formats can be indexed.

Only PKGs can have scripts packaged with it.

DMG will unpack into all users home folders if thats how its been packaged (i.e. the path for the item is /Users/admin/Desktop/[item to install]) but you have to mark the package that it will FEU (Fill existing users) and/or FUT (fill user templates).

 

Neither is "better". Both have their appropriate uses.

More information

karthikeyan_mac
Valued Contributor

I prefer .pkg because of pre or postinstall script

jcarr
Release Candidate Programs Tester

Only DMGs support relative paths for FEU (fill existing users), so if you want to include a ReadMe or user guide on the desktop for each user on the system, you'll need to use a DMG.  PKGs are more flexible however (e.g. can be pushed via ARD or installed via Jamf Pro).  Which you use really depends on your use case.

mm2270
Legendary Contributor III

I prefer PKG format because it's native to the OS and is more portable. The thing about the DMG format used with Jamf Pro is that it's proprietary. You can't just hand it to someone to use it for installation or use it in any other deployment scenario, at least not if it has any type of complexity contained within it. Pkgs usually will work with other installation methods outside of Jamf Pro as mentioned above.

Also, @jcarr said:

if you want to include a ReadMe or user guide on the desktop for each user on the system, you'll need to use a DMG.


Technically true, but with the right scripting know-how, for simple items like placing a document on every user's Desktop, it's possible to do with a PKG format and a postinstall script.

jcarr
Release Candidate Programs Tester

Agreed, although while it is possible with scripting to move/create files and adjust permissions etc., that does require a little more knowhow than using the built in FEU/FUT capabilities.  The being said, .PKGs are definitely more flexible if multiple installation vectors are needed (e.g. ARD).

mm2270
Legendary Contributor III

Yes, agreed. That’s why I qualified my comment by mentioning simple deployments, like 1 or 2 files all going to the same location. I would not, for example, attempt to use a pkg if I needed several files and folders in different paths to be copied to all user accounts. That would be a bit more complicated and error prone. In a case like that I’d just go with a DMG format. 

gabester
Contributor III

DMG and PKG have different purposes. DMG were always intended to be end-user friendly / facing for simple deployments, and Jamf Pro added a little special sauce for the FEU/FUT operations. I was taking advantage of that for a while with a script to install applications from DMG, presuming the apps were on the root level, so I'd just "Install" the DMG which would copy whatever *.app was contained onto the Mac's root filesystem, but Catalina and newer macOS' security and volume arrangements prevent the existing Jamf "install DMG" functionality from working as intended for those protected partitions. Additionally, certain orgs may be so concerned about data exfiltration that you may not be able to create and write to a mounted DMG!

As such, I now prefer PKG and scripts to do the extra bits when possible. It's not a far stretch when scripting to collect the folders in /Users or the assigned home directories of usernames that don't start with _ using dscl and enumerate them into a loop to copy or link wherever needed.

I may have been driven to shy away from DMG as well by the suggestion that they may be something Apple stops supporting and then deprecates at some point... and now that macOS is delivered as .ipsw on Apple silicon, I can see that happening by the macOS "Death Valley" release!