Creating a package to distribute a configuration profile

arekdreyer
Contributor

Sometimes you want to add a configuration profile to a Mac during imaging.
Here's one way. (I updated the article thanks to a suggestion from @macjutsu - I originally placed the mobileconfig file in /var/tmp, but we like placing items in /Library/<Your Organization's Name>). And I added a reference to @timsutton's Make Profile Pkg thanks to a suggestion from @daz_wallace.

Get the Configuration profile into place.

  1. In Jamf Pro, create the configuration profile if it's not already created.
  2. Scope the configuration profile to the Mac computers that will receive this configuration profile, otherwise Jamf Pro will remove the configuration profile when the Mac is enrolled!
  3. Click Download to download the configuration profile. 1a3b2495fc4c4f0c83b8dbeb78063290
  4. The Profiles preference automatically opens and asks if you want to install the configuration profile. Click Cancel, because you just want to download it, not install it.
  5. Alternative to Composer: You could use @timsutton's Make Profile Pkg then skip to the "Test" section, then complete the "Upload to Jamf Pro and add to a configuration" section at the end of the article.

If you don't already have a folder for organzational assets in /Library, create one now.

  1. In Finder, choose Go > Go to Folder.
  2. In the "Go to the folder" window, enter /Library, then click Go.
  3. Choose File > New Folder (Shift-Command-N).
  4. Enter adminstrator credentials then click OK.
  5. Change the new folder's name (probably "untitled folder") to be your organization's name (press Return to start renaming, enter text, press Return again to save the change, enter adminstrator credentials when prompted, then click OK). Hint: consider not using a space character in the name; if you use a space in the name you'll need to always remember to escape the space with a backspace.
  6. Open your new folder, and keep this Finder window open.

If the /Library/<Your Organization's Name> folder isn't already open, open it now.

  1. In Finder, choose Go > Go to Folder.
  2. In the "Go to the folder" window, enter /Library/Zabazakka, then click Go. Of course, your organization's name is probably not Zabazakka, so replace it with your organzation's name.

Copy the file from ~/Downloads to /Library/<Your Organization's Name>.

  1. In Finder, choose File > New Finder Findow (Command-N), then choose Go > Downloads (Option-Command-L).
  2. Optional: If you have many files in Downloads, click the Column view icon in the Finder toolbar, then click the Date Modified column to change the sort order to easily find the .mobileconfig file.
  3. Drag the .mobileconfig file you just downloaded from the Downloads folder to the /Library/<Your Organization's Name> folder.
  4. Be sure to keep the /Library/<Your Organization's Name> Finder window open for the next steps.

Use Composer to package it up along with a postinstall script.

  1. Open Composer.
  2. If you see the window titled "Choose a method to create your package," click Cancel.
  3. Move windows around so you can see both the sidebar of Composer and the /Library/<Your Organization's Name> Finder window.
  4. In Finder, drag the mobileconfig file from the /Library/<Your Organization's Name> folder to the sidebar of Composer. a160e5d3de1249d8a70d84a613f084bf
  5. In Composer, in the Sources section, select the new package that was created. It has the same name as the mobileconfig file you just dragged.
  6. Click the disclosure triangle for the new package.
  7. Right-click Scripts, choose Add Shell Script, then choose postinstall. 7ddb1f11ac3040d0b555f4ceedfc2f46
  8. In the Composer sidebar, select the postinstall script.
  9. Edit the script in the main window of Composer. If the path or filename for the mobileconfig file has a space, be sure to use the backslash to the name to protect the space character. Add a line like the following:
    /usr/bin/profiles -I -F /Library/My Organization Name/my special config.mobileconfig
    b15fe85cd37b4475b60f475866026d43 Hint: When you drag the mobileconfig file from Finder to Terminal, the path and filename will be displayed with any special characters (like the space character) properly escaped with a backslash. If you drag the mobileconfig file from Finder to the script editor in Composer, the space character won't be escaped with the backslash.
  10. Optional: After the /usr/bin/profiles line, enter a line to remove the mobileconfig file from /Library/<Your Organization's Name>, like
    rm -rf /Library/My Organization Name/my special config.mobileconfig
  11. Select your package in the Sources section of the Composer sidebar.
  12. At the "Do you want to save changes" dialog, click Save.
  13. Click Build as Package in the toolbar.
  14. Specify the destination to save the package, then click Save.

Test.

  1. Copy the package to a test Mac.
  2. Open the package and complete the installation.
  3. Open the Profiles preferences and confirm that the configuration profile has been installed. ec6851394ded4f36a414f70274638fe9 Don't worry that it's listed as Unverified.

Upload to Jamf Pro and add to a configuration.

  1. In Casper Admin, drag the package to your main repository.
  2. Double-click the package in the main repository.
  3. Click the General tab.
  4. Choose a category.
  5. Click the Options tab.
  6. Choose a priority. I like setting the operating system as 1, and a Wi-Fi profile as 2. It's up to you of course.
  7. Select the checkbox "Install on boot drive after imaging". d63da9fed73e4dcbabc9221118cbfd83
  8. Click OK to close the window.
  9. Save (Command-S) your work in Composer.
  10. Drag the new package into a configuration that you use with Casper Imaging.
  11. If you already have Casper Imaging open, in Casper Imaging click Refresh in the toolbar.

Bonus: If you have a Developer ID, don't forget to sign your QuickAdd package. ee0e5173eaa14e70b7bf12c3a92447e0

2 REPLIES 2

daz_wallace
Contributor III

Hi @arekdreyer

After step 4, you could actually replace it with the open source Make Profile Package so you don't need to use Composer : )

Just my 2 cents

Darren

arekdreyer
Contributor

Thanks, updated.