Mac – SCCM – CMMAC and PKG

email me

I noticed while creating a package on a Mac, which would eventually be added to SCCM, Microsoft’s instructions on the entire process were pretty vague in places. Here are my own notes on packaging and CMMACs.


Build Process


On Dev Mac

Create your YourApp.py (I used pycharm) > use pyinstaller to create APP file > add APP file + any scripts to Packages > use Packages to create PKG > use CMAppUtil to create CMMAC > add to SCCM

CMAppUtil command (used to create the SCCM CMMAC file):

sudo ./CMAppUtil -c PackageName.pkg -o ./

sudo  ./CMAppUtil -c PackageName.dmg -o ./

 


What a CMMAC file looks like

You can browse, add, or remove files by using 7zip (something no one tells you)

CMMACPackage
—-Metadata
——-Detection.xml
—-contents
——-script.sh (SCCM command. I use a script because I can add complexity to installation)
 ———-/usr/sbin/installer -pkg “YourApp.pkg” -target “/” -verboseR
——-YourApp.pkg (created using Packages app)
———-YourApp.app (main app created using pyinstaller, update plist with version)
———-script.command (set up for the daemon launch agent + other commands)
———-com.YourApp.plist (launch agent instructions)

 

 

In SCCM, Add CMMAC Package


Step 1 –
Add package to SCCM using CMMAC file (select defaults)

a – Create APP using pyinstaller
b – Create PKG using Packages. Copy from build folder, to CMAppUtil folder
c – Create CMMAC using CMAppUtil
d – Copy CMMAC to SCCM server/Distribution Point
e – Start Application setup in SCCM using Applications Node


Step 2 – Deployment Type

Verify/Update Deployment Type > Programs with SH, APP, or PKG command line
/bin/sh “script.sh”
/usr/sbin/installer -pkg “Package.pkg” -target “/” -verboseR


Step 3 – Distribute Content

a – Wait for content to be fully synced
b – Wait 5 minutes after content has been synced


Step 4 – Set up Deployment
(select defaults)

a – Wait 5 minutes for deployment to sync


Step 5 – Force refresh on client machine
(use Connect To on Config Manager app)

a – Monitor Library > Caches > Microsoft > CCM > Content folder
b – CMMAC should download, extract, and run

 

Some of my Working Files


YourApp.app: Info.plist

Make sure your Info.plist in the APP looks something like this before creating the PKG file

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>CFBundleDisplayName</key>
<string>YourApp</string>
<key>CFBundleExecutable</key>
<string>MacOS/YourApp</string>
<key>CFBundleIconFile</key>
<string>icon-windowed.icns</string>
<key>CFBundleIdentifier</key>
<string>com.domain.app.YourApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>YourApp</string>
<key>CFBundleVersion</key>
<string>1.0.1</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<key>CFBundleGetInfoString</key>
<string>1.0.1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
    <string>MacOSX</string>
</array>
<key>YourAppVersionString</key>
<string>1.0.1</string>
</dict>
</plist>

 

YourApp.app: version.plist

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>BuildAliasOf</key>
<string>YourApp</string>
<key>BuildVersion</key>
<string>1.0.1</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<key>CFBundleVersion</key>
<string>1.0.1</string>
<key>ProjectName</key>
<string>YourApp</string>
<key>SourceVersion</key>
<string>10100</string>
</dict>
</plist>

 

CMMAC: Detection.xml

The Detection file is what SCCM uses to import package settings into the details of the SCCM Application, which are in turn used to identify if the PKG has been deployed to the Mac. If this isn’t working properly, the PKG will continually be deployed to the Mac—you don’t want that.

<?xml version=”1.0″ encoding=”UTF-8″?>
<CMAppUtil Version=”5.00.8466.1000″ TimeStamp=”2019-03-28 20:49:41 +0000″ MacOSX=”10.13.4″ xmlns=”http://schemas.microsoft.com/SystemCenterConfigurationManager/2011/10/25/CMMAC”>
<Package PackageName=”YourApp.pkg” PackageType=”pkg”>
<DetectionAction Type=”Basic”>
<Property Identifier=”com.domain.app.YourApp” Version=”1.0.1″ Type=”AppBundle”/>
</DetectionAction>
<OptionalPackages>
</OptionalPackages>
<InstallerParams VolumeInfo=”/” RestartAction=”None”/>
</Package>
</CMAppUtil>

 

 

Notes

also see: Mac – Bash – Package-Repackage

 

tags: CMMAC, CMMAC design, SCCM CMMAC scripting, SCCM Development, MrNetTek