Home > Automator, First Boot Package Install Generator, Mac administration, Mac OS X, macOS, Packaging, Scripting > Apple Setup Assistant and First Boot Package Install Generator.app

Apple Setup Assistant and First Boot Package Install Generator.app

A while back, I built an Automator application named First Boot Package Install Generator.app. It’s designed to generate installer packages, where the generated packages in turn serve as a delivery mechanism to enable other installer packages to be installed when a Mac boots up.

As part of the process of installing the other installer packages, an application named LoginLog is supposed to open over the login window and display a log of what actions are taking place, what is being installed and whether that particular installation succeeded or not.

Screen shot 2014 10 19 at 2 39 21 pm

For the most part, this process of launching LoginLog and displaying the log works as designed but it was brought to my attention that there was one scenario where LoginLog did not appear as expected. When a firstboot package created by First Boot Package Install Generator.app was installed onto a new installation of OS X El Capitan, LoginLog did not appear over the Setup Assistant.

Screen Shot 2016 06 21 at 8 11 00 PM

The reason it didn’t appear is because the LaunchAgent for LoginLog is triggered by the Mac being at the login window.

Screen Shot 2016 06 21 at 8 04 30 PM

However, Apple’s Setup Assistant on El Capitan no longer runs over in the context of the login window. Instead, it runs in the context of an account named Setup User.

Screen Shot 2016 06 21 at 8 07 23 PM

In order to have LoginLog appear again in this scenario, I needed to develop a method which could accomplish two tasks:

  1. Suppress Apple’s Setup Assistant during the time when I wanted the LoginLog application to appear.
  2. Avoid interfering with an otherwise desired launch of the Apple Setup Assistant.

For more details, see below the jump.

To accomplish both tasks, I added functionality to the firstboot script to check to see if the /var/db/.AppleSetupDone file is present on the boot drive when the Mac starts up. The reason this check has been added is that when the /var/db/.AppleSetupDone file is present at startup time, Apple’s Setup Assistant is prevented from running. Based on the results of the check, the following actions are performed:

  • If the /var/db/.AppleSetupDone file is already present, nothing needs to be done and the script proceeds.
  • If the /var/db/.AppleSetupDone file is not present, the script will add add the /var/db/.AppleSetupDone file and an additional /var/db/.firstboot.delete.AppleSetupDone file:


Once both the /var/db/.AppleSetupDone and /var/db/.firstboot.delete.AppleSetupDone files have been added, the Mac will reboot so that the presence of the /var/db/.AppleSetupDone file can be detected by the OS:


In turn, the functionality to add both the /var/db/.AppleSetupDone and /var/db/.firstboot.delete.AppleSetupDone files is triggered only when the script detects the presence of the directory which stores the installer packages which are being installed at startup.


The reason that the /var/db/.firstboot.delete.AppleSetupDone file is added is to provide verification that the firstboot script added the /var/db/.AppleSetupDone file to suppress the Apple Setup Assistant, which in turn allows the LoginLog application to launch and display the log over the login window.

If both the /var/db/.firstboot.delete.AppleSetupDone and /var/db/.AppleSetupDone files are present, both files are later removed by the script to avoid interfering with an otherwise desired launch of the Apple Setup Assistant. If only the /var/db/.AppleSetupDone file is present, no action is taken to delete it:


To help Mac admins verify that the status of the /var/db/.AppleSetupDone file is what they expect, an Apple Setup Assistant status check has also been added to the log displayed by LoginLog.

If the /var/db/.AppleSetupDone file is not present after all the packages have been installed, a message is displayed that the Apple Setup Assistant will appear at the next reboot.

Screen Shot 2016 06 20 at 9 53 03 PM

Screen Shot 2016 06 20 at 9 53 05 PM

If the /var/db/.AppleSetupDone file is present after all the packages have been installed, a message is displayed that the Apple Setup Assistant is set to be skipped and will not appear after the next reboot.

Screen Shot 2016 06 20 at 9 56 57 PM

Screen Shot 2016 06 20 at 9 56 59 PM

For more information, please see the release notes for First Boot Package Install Generator 1.5:


For the latest version of First Boot Package Install Generator.app, please see the link below:


For those who want to build a customized First Boot Package Install Generator.app for their own use, the components and scripts are available on my Github repo.

  1. June 22, 2016 at 8:02 am

    Fabulous – many thanks for this.

  2. AlexS
    December 6, 2016 at 3:38 am

    This is awesome and exactly what I think I am looking for… Couple questions if you would indulge me. I am doing something very similar except I am trying to do this after I start the upgrade from a previous OS. I start the install of the OS, and when it is done upgrading, I want the LaunchAgent to run before the login window. Currently what happens is the OS upgrade completes, presents the user with the login window with their username filled out, and just asks for password, and the Agent never runs. If they log out, obviously the LaunchAgent then runs and everything works fine…

    Can I utilize something like this to run the app installs post OS upgrade?

  3. OH
    October 17, 2018 at 5:35 am

    I tried it together with an installation of macOS 10.14 (installr), and found, that it is not working.
    After rebooting the script is not trigered. The Computer stays in the language selection window.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: