Creating a Default User account for macOS Images
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
- Login to a fresh installation of OS X as a local administrator account.
- 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.
- 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.
- 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.
- 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
- 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
- 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/*
- 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.
Copying settings as the default settings for any new user account
- First open Terminal and enter sudo –s. Authenticate with your Administrator username and password.
- Now we will reset the system wide default account. Open your Terminal and type the following:
rm –rf /System/Library/User\ Template/English.lproj - 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
- Reboot the computer and log back into your Administrator account. Launch Disk Utility and select your hard drive. Click First Aid > Repair Disk Permissions.
- Once permissions have been fixed, browse to System Preferences > Users & Groups and delete the default account you created earlier.
- 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.
- 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.
- Enter the following commands:
fsck –fy
/bin/mount –uw /
rm –rf /var/db/.AppleSetupDone
shutdown –h now