Packaging Apps in MacOS
Deploying apps through a management system on any platform requires an extortionate amount of "gotcha's" if you aren't familiar with said platform.
Unfortunately for most, with the prevalence of Windows in the Enterprise, exposure to these gotcha's on MacOS is not all that common and is sure to be something that can cause issues for first time Mac admins.
Luckily, 90% of the apps you come across can be diagnosed/packaged/deployed by just knowing a few core aspects.
Hopefully this article will help people become more comfortable with app deployment on MacOS.
What will these steps work on?
Theoretically any management system can deploy the 'types' below, however most of my testing was with the Mosyle platform, a modern MDM that's been built as a cloud first MDM with a simple to use GUI, fantastic support and a great overall experience for deployment.
Formats - PKG, ZIP & DMG
Whilst there are a few other methods/formats, for ease of use, you can deploy images via 3x formats, DMG, PKG & ZIP.
Mosyle allows its agent to 'unzip' a given container (DMG or ZIP) and its contents, usually a .app file, into the /Applications folder of the MacOS device.
Where as PKG files are just 'normal' installers.
PKG Installers
PKG should automatically install and require no further input, however occasionally the BundleID/Version do not correct themselves during import and needs to be manually edited in Mosyle.
Please see the section 'getting bundle ID and version', below.
ZIP Installs
ZIP file installs will have Mosyle unzip the *.app file from the zip and place in the /Applications folder on the device.
Occasionally the BundleID/Version do not correct themselves during import needs to be manually edited in Mosyle. Again, see the section 'getting bundle ID and version', below.
DMG Images
These are the most troublesome - they function similar to ZIP's, however where the DMG has a custom EULA or multiple apps are contained within, it sometimes needs to be re-packaged.
To do this, unzip the DMG and get the *.app file, place it in a new folder on your desktop with the apps name.
Go to "Disk Utility", File, New Image, Image from Folder.
Select the folder.
Click 'Choose', then change the name of the image so you can differentiate for yourself, for example, PyCharm_v1.2
Upload this new DMG into Mosyle.
Lastly, check BundleID/Version.
Getting the Bundle ID & Bundle Version
You will need to have completed a manual installation of the application first, then open Terminal.
Bundle ID
osascript -e 'id of app "Business"'--> com.jetbrains.pycharm
The output is the Bundle ID.
Bundle Version
To find the app version, right click on the app in the /Applications folder and click "Get Info" or review the app Info.plist, where it will be referred as "CFBundleShortVersionString"
- You can get both bundle info's on a Windows machine by opening the DMG/ZIP/PKG with 7Zip and browsing to the info.plist in the same way.
- Make sure that the uploaded file does not have a space in the name, otherwise the install will fail. This will be fixed in a future Mosyle release.
Deploying
Now that you have a created a custom deployment package/made the relevant corrections, you should find that the vast majority of applications should deploy via your MDM without further issue.
For those that are more troublesome however, i highly recommend the MacAdmins Slack, asking in the packaging server (if there is not a channel specifically for the software in question).
Alternatively, if you use Mosyle, ask their support and give them as much information as you can on what you have tried.
They are extremely helpful.