Creating a Default User account for macOS Images

Gilbert J Palau
Enterprise macOS
Published in
3 min readApr 19, 2018

The following process is especially useful when building a Mac OSX Image with a predetermined configuration for every user that logs into the machine.

Default Account Creation

  1. Login to a fresh installation of OS X as a local administrator account.
  2. Open System Preferences > Users & Groups and create a new admin user with the name Default and a simple password. This account will be removed at the end of the process but the settings will remain.
  3. Log out of the admin account and log into the newly created Default account. Once logged in, install and launch any additional software you would like to be included in your system image.
  4. Configure software settings and System Preferences to your specifications. Apply all available Apple system updates. Some updates may require a restart. Customize the Dock with the icons you would like to show for all users.
  5. Programs and scripts can also be configured to automatically launch at login. The list of applications that will automatically launch can be found at System Preferences > Users & Groups > Default user account > Login Items.

Cleaning the Default Account

  1. To clean the Default Account we are going to need to unhide the Library account which is hidden in OSX Lion, Mountain Lion and Mavericks. To do this, open Terminal and type: chflags nohidden ~/Library
  2. Now with finder navigate to /Users/default/Library/Caches and delete the entirety of the folder contents. While still in Finder click Go > Recent Folders > Clear Menu. If for some reason you have trouble emptying the trash bin, because files are in use, simply open Terminal again and flush the trash bin manually by typing: rm –rf ~/.Trash/*
  3. Restart the computer and log in with the Administrator account.

Cleaning the Keychain

The script below should take care of any issues with the keychain by making sure it has been completely removed, so that it will be created from scratch when a new user logs in.

*Credit goes to James Robson from Mac Enterprise (MACENTERPRISE@lists.psu.edu)

Copying settings as the default settings for any new user account

  1. First open Terminal and enter sudo –s. Authenticate with your Administrator username and password.
  2. Now we will reset the system wide default account. Open your Terminal and type the following:
    rm –rf /System/Library/User\ Template/English.lproj
  3. Now you are going to copy the new default account settings you configured earlier into the system wide default account: sudo cp –R /users/default/ /System/Library/user\ Template/English.lproj
  4. Reboot the computer and log back into your Administrator account. Launch Disk Utility and select your hard drive. Click First Aid > Repair Disk Permissions.
  5. Once permissions have been fixed, browse to System Preferences > Users & Groups and delete the default account you created earlier.
  6. After this last step you can capture the image with your preferred method.

Optional steps (or how to setup the OOBE)

The following steps are optional and only needed if you want to deploy your image with an Out of Box Experience.

  1. To Seal the system and prepare for Out of Box Experience (OOBE), reboot the system and hold down CMD+S at startup. If done correctly you will boot into a Unix Terminal in single user mode.
  2. Enter the following commands:
    fsck –fy
    /bin/mount –uw /
    rm –rf /var/db/.AppleSetupDone
    shutdown –h now

--

--

Gilbert J Palau
Enterprise macOS

macOS Wizard at computer on wheels car company, High Cleric of Nano, Curator of Fine Coffee, Destroyer of Tacos, Scourge of Crafted Beer.