This post will describe how to package and deploy Mathematica and an associated license to eligible clients via Munki. An easily modifiable script for building a license pkg can be found on my Github.
Prerequisites:
- Mathematica_$VERSION.dmg
- The license info for your organisations Mathematica setup.
Preparing Mathematica:
- Mount the .dmg
hdiutil attach /path/to/Mathematica_$VERSION.dmg
- The disk image for Mathematica 11 includes the .app bundle and an installer pkg for 'Mathematica Extras'. We'll import both separately.
- Import the Mathematica.app, creating a new .dmg:
munkiimport /Volumes/Mathematica/Mathematica.app
- Configure the
pkginfo
metadata to your requirements. In this case, we are usingMathematica11
for thename
key. Theinstalls
array defaults should be sufficient.
Importing Mathematica Extras:
- Import the package:
munkiimport /Volumes/Mathematica/Extras.pkg
- Add the following key to the
pkginfo
file:
<key>update_for</key>
<array>
<string>Mathematica11</string>
</array>
Package the license:
- There's a few ways of configuring license settings with Munki (
postinstall_script
, built into a repackaged version of the application). However, my preference is, where appropriate, to build a package to deliver the license file or settings to a given client, and then use Munki'supdate_for
functionality to deploy it. Building a package with a logical identifier and version makes it trivial to deploy changes to the license when needed. - In my organisation, I'm fortunate enough to only need to tell the Mathematica install which license server it needs to point at. Users are granted access in a server side config file, so we simply need to deploy a file containing the server name to the client, in a location that Mathematica knows about.
- To start, make a working directory:
mkdir -p mathematica-license-pkg/Payload
cd mathematica-license-pkg
- Copy or create the license file in the Payload directory:
cp /path/to/your/orgs/mathpass mathematica-license-pkg/Payload
Or:
echo "$YOUR_MATHEMATICA_LICENSE_SERVER" > mathematica-license-pkg/Payload/mathpass
- Build the package. In this case, I'm using the year the package was built for the version, as this is relevant to the license setup in my organisation. Use a version appropriate to your needs:
pkgbuild --root Payload --install-location /Library/Mathematica/Licensing --version 2016 --identifier your.org.mathematica-license Your-Org-Mathematica-license.pkg
- Import the package:
munkiimport Your-Org-Mathematica-license.pkg
- Configure the pkginfo as follows:
<key>update_for</key>
<array>
<string>Mathematica11</string>
</array>
- Run
makecatalogs
makecatalogs
- Create a software manifest for Mathematica, in order that access to the application can be scoped to appropriate machines:
manifestutil
> new-manifest $YOUR_MATHEMATICA_MANIFEST
> add-pkg Mathematica11 --manifest $YOUR_MATHEMATICA_MANIFEST --section optional_installs
> exit
- And you're done. You can now use this as an
included_manifest
to distribute the application your clients.