How Do I Automate Deployment of CrashPlan to macOS? (For Administrators)

Below is a download link to the standard custom Code42 template (with ACCC server settings preconfigured), and a preconfigured and precustomized .dmg that prevents the application from starting automatically right after installation, and sets the user variable to the output of

last | grep console | grep still | awk '{print $1}' | head -1

If the premade installer fits your needs, you can skip right to deployment. Else, read on below. 

Download links:

Full Customized Application

Pre-Customized Scripts

Vanilla macOS Installer v 4.8.2


Modifying the CrashPlan installer for automated deployments on macOS is not difficult, but it is also not trivial. How it works will be highly dependent on your use case, your deployment methods, and what your software/endpoint management capabilities are.

Unzip the Pre-Customized Scripts folder downloaded above. This custom template contains two files that are of use to you. One, called, has already been populated with the necessary information (server address, reg key, etc). You won’t need to modify this.

The second file is called This script controls a number of installer behaviors, including deciding which user to install for and where their home directory is located, whether to open the application automatically after installation finishes, etc.

By default, the script will tell the installer to assume that the basename of the $HOME variable is the user. Because most endpoint management suites install software remotely as root, or as another user with elevated privileges, this makes automated installation difficult or impossible.

In the script, you will see four variables (along with some helpful comments from Code42 that can explain the mechanisms of the script).

The most broad solution is to assume that the last logged in user is who we want to install the client for (and to start automatically backing up for). This can be achieved by setting the scripts “user” variable to the output of the following shell command:

last | grep console | grep still | awk '{print $1}' | head -1

A word of warning, this only works if log ins are somewhat frequent, a desktop machine with long uptimes and few log outs might not list who you want to install for, and will output other local service accounts that can spawn console sessions. Test the output of the script a few times on some target machines to ensure the output is what you want it to be. Alternatively, you can read the value from

/usr/bin/defaults read /Library/Preferences/ lastUserName

There are other methods as well, such as parsing the username from the Mac’s computer name (which is often the Mac’s AD object name). If you include usernames in your naming scheme, this might be a good option. Code42 lists the scutil command in their suggestions, but you can also use dsconfigad (see below) to parse the object name out (though you would have to figure out how to trim anything else off to get the username only).

dsconfigad -show | grep "Computer Account" | awk '{ print $NF }' | sed 's/$$//'

That will output *just* the object name.

Basically, any shell script that will output the local username (which should be the same as their netID anyways) can be used to set the value of the $user variable in the script. 

In the past, the custom installer was generated by running the script, but it relies on some pattern matching that doesn’t work anymore (and won’t until ACCC pushes the client versions to 6.0+), so you’ll have to generate it manually.

Mount the CrashPlanPROe_*_.dmg you downloaded earlier. Copy the pathname of your custom folder by right clicking, then holding option and clicking Copy As Pathname.

In a terminal:

cd /Volumes

cd CrashPlanPROe

cp -r <yourpathnamehere> ./.Custom

Eject the diskimage. The .dmg is now customized.


This again is highly dependent on what software you’re using to deploy the software. I’ve found it to be more reliable to simply install the contents of the disk image to a folder, then run the installer via a pkginstall script locally. It is also reasonable to mount the dmg via script, then have pkginstall run from the mounted volume. Some deployment software support the “pkg in a dmg” type installer that Code42’s customization method generates. You might also consider repackaging the software into a metapkg, then invoking the CrashPlan.pkg via a postinstall script. As they say, there is more than one way to bake a cake. 


Need help?

Last updated: 

October 23, 2017

Browse by tag