Most of my Mac apps don’t come from the App Store. They’re DMGs, PKGs and zip files from vendors’ websites, and Intune can deploy all three. Doing it reliably took more work than I expected.
This post is the script I ended up with, and the four problems that shaped it.
This is Part 5 of Zero-Touch Mac, a series about building a managed Mac from Apple Business and Intune with every policy, profile and app scripted through Microsoft Graph.
One script for every download
Deploy-AKCMacApp.ps1 takes a DMG, PKG or zip, from a file or a download link, and does the rest:
- Opens it and finds the app inside.
- Reads the app’s bundle ID and version from its
Info.plist, and its icon. - Encrypts the package the way Intune expects (AES-256 with an HMAC), uploads it in blocks and commits it.
- Creates the app as macOS - Name, or adds a new version to the existing app with the same bundle ID.
- Makes it Available to all users, so it appears in Company Portal.
./Deploy-AKCMacApp.ps1 -Path ~/Downloads/Obsidian.dmg # dry run
./Deploy-AKCMacApp.ps1 -Path ~/Downloads/Obsidian.dmg -Apply
The dry run prints the name, bundle ID, version and size before anything is uploaded. Read it. Most of my mistakes would have been caught there.
Problem 1: the download is only an installer
A surprising number of “Mac downloads” don’t contain the app. They contain a small installer that fetches the app when you run it. Spotify’s standard download is 1.8 MB and holds Install Spotify.app. ChatGPT and Adobe do the same.
Deploy one of those and Intune installs the installer, not the app. So the script refuses any app with “Install” in its name unless you name it with -AppName, and tells you why.
The fix is to find the vendor’s full download. Spotify publishes one for Apple silicon (about 179 MB). When there isn’t one, Part 7 covers what I did instead.
Problem 2: apps arriving “damaged”
This one took the longest. ChatGPT installed, then wouldn’t open: “ChatGPT is damaged and can’t be opened. You should move it to the Bin.” Later, Elgato Studio did exactly the same.
The app wasn’t damaged. It was inside itself:
find "/Applications/Elgato Studio.app" -maxdepth 3 -name "*.app" -not -path "*/Contents/*/*"
codesign --verify --deep --strict "/Applications/Elgato Studio.app"
The first command showed Elgato Studio.app/Elgato Studio.app. The second failed with unsealed contents present in the bundle root.
When Intune installs a DMG app and a copy is already in Applications, it can copy the new app into the existing one instead of replacing it. The extra copy inside breaks the outer app’s code signature, and macOS calls that “damaged”.

The fix is to stop deploying DMGs. With -AsPkg, the script copies the app out of the DMG and builds a proper installer package around it with pkgbuild, set so the app always installs to /Applications and replaces any existing copy:
./Deploy-AKCMacApp.ps1 -Path ~/Downloads/ElgatoStudio-2.0.0.2230.dmg -AsPkg -Publisher Elgato -Apply
Intune can’t change an app’s type, so moving an app from DMG to PKG means deleting the old app first. The script checks and tells you if it finds one.
I now use -AsPkg for everything.
Problem 3: the app the DMG hides
Parallels Desktop’s DMG only shows Install.app. The real app is in there too, but marked hidden. A normal file listing doesn’t see it, so the script found only the installer and stopped.
The script now looks for hidden files as well, takes the app named with -AppName, and clears the hidden flag on the copy it packages:
./Deploy-AKCMacApp.ps1 -Path ~/Downloads/ParallelsDesktop-27.1.0.dmg -AppName "Parallels Desktop" -AsPkg -Apply
Getting Parallels to start was another story, in Part 6.
Problem 4: what Intune thinks is installed
Intune works out whether a Mac app is installed by looking for its bundle ID among the apps the Mac reports. Three things follow from that.
Self-updating apps. Almost every app here updates itself. If Intune also checks the version number, an app that has updated looks like a different version. A Required app can then show as not installed, or be put back to the older version. So the script tells Intune to ignore the version by default. Use -DetectVersion only when you deliberately want Intune to hold an app at one version.
Status lag. VS Code showed Failed in Company Portal while it sat in Applications working perfectly. The Mac hadn’t reported it yet. Wait for the next check-in before you start debugging.
Apps with no .app. The GitHub CLI showed Failed forever, because a command-line tool has nothing in Applications for Intune to find. Those don’t belong in Intune as apps at all (Part 8).
Things I keep having to look up
- Force a check-in. The Intune agent checks in roughly every eight hours.
sudo killall IntuneMdmDaemonmakes it check in now. Check Status in Company Portal does the same from the user’s side. - Company Portal showing an old list. Quit Company Portal and delete its cache at
~/Library/Caches/com.microsoft.CompanyPortalMac. - A failed upload. An app whose first upload fails stays unpublished and can’t be updated. Delete it and run the script again.
- Available means users. Intune only lets you make a Mac app Available to users or user groups, not devices.
- Icons.
Set-AKCMacAppIcons.ps1fills in any app missing an icon, using the icon from the copy installed on the Mac. - Lists in zsh.
-Apps Obsidian, VLCarrives in PowerShell asObsidian,andVLCwhen run from zsh. My scripts split on commas so either form works.
What’s in Company Portal now
Obsidian, VLC, MakeMKV, Plex, Spotify, Elgato Studio and Stream Deck, AltTab, Claude, ChatGPT, VS Code, GitHub Desktop, Docker, Azure Storage Explorer and Parallels Desktop, all as PKGs and all optional.
Next in the series: why some of those apps still wouldn’t open, and what Parallels had to do with it.
Comments
No comments yet — be the first to leave one below.