Skip Yosemite Setup Assistance

KyleEricson
Valued Contributor II

Does anyone know how to do this?

I want to have an admin account setup and skip the rest of the setup.

https://discussions.apple.com/thread/2152439

Hello everybody

First of all I have Netinstall up and running. My Problem is however:

Everytime a client installs Mac OS X from a Netinstall Image, the Apple Setup Assistant pops up (for registration, mobileMe, and to create an Administrator Account!). I haven't found anything in System Image Utility that would disable the Setup Assistant. I don't really see the point of Netinstall anymore because of this.

How can I kill the Setup Assistant and instead run a script that would create a predefined Administrator account?

What I've tried:

Built a package that replaces "/System/Library/CoreServices/Setup Assistant/Contents/MacOS/Setup Assistant" with a bash script (also called Setup Assistant) that creates an Admin account with dscl.

However the Netinstall fails, and I can't find the problem?

Can anybody help me to get rid of this Setup Assistant ? Thank you very much!

Edit: The inspiration came from this thread http://discussions.apple.com/thread.jspa?messageID=8319142&#8319142

Message was edited by: Scotch22

MacBook, MacBook Pro, MacPro, ..., Mac OS X (10.6)
This solved my question Solvedby foilpan on Sep 10, 2009 6:33 AM
add a custom package or script in your workflow to touch the file /var/db/.AppleSetupDone, but be sure you have a script in there somewhere to either create or add the local user before reboot.

you'll find some helpful tips in the instadmg forum here: http://www.afp548.com/forum/index.php?forum=45

Read My Blog: https://www.ericsontech.com
15 REPLIES 15

rderewianko
Valued Contributor II

@rtrouton has a great post discussing This

KyleEricson
Valued Contributor II

Now What about user creation. I use system image utility to create a user account but that doesn't seem to work for NetInstall. Any ideas?

Read My Blog: https://www.ericsontech.com

georgecm12
Contributor III

@kerickson: use MagerValp's (Per Olofsson's) CreateUserPkg

KyleEricson
Valued Contributor II

I get this error trying to add the .pkg files e7e4b4a1947e49d08beeaacf911cfe0d

Read My Blog: https://www.ericsontech.com

rderewianko
Valued Contributor II

What's int he pkg file you've made?

KyleEricson
Valued Contributor II

I made a user account and the skip the apple setup both two .pkg files.

Read My Blog: https://www.ericsontech.com

davidacland
Honored Contributor II

In Yosemite you can create user accounts with sysadminctl. I've blogged the process and all the other bits for our first boot script here: http://www.amsys.co.uk/2015/01/creating-first-boot-script/

KyleEricson
Valued Contributor II

When I follow your guide for the scripts what format do I save them as.
Do they have to be part of a .pkg file to work. I got the admin account to work but now need to skip the iCloud,timezone and all of that stuff.

Read My Blog: https://www.ericsontech.com

KyleEricson
Valued Contributor II

David can you help me get the script customized?
I seems to need it to be part of a .pkg file to even run is there a way to just put in a script in system image utility.

Read My Blog: https://www.ericsontech.com

davidacland
Honored Contributor II

Hi @kericson

The script needs to be run on first boot of the new OS. If you are using Casper, you just add the script to the Casper Admin configuration and set it to run at reboot once the imaging has finished.

If you are using something like DeployStudio you can use that to run a postponed script.

Failing that, you would need to package it and run it via a LaunchDaemon that delete after completion.

KyleEricson
Valued Contributor II

Is this any difference or changes with 10.11 El Capitain?

Read My Blog: https://www.ericsontech.com

davidacland
Honored Contributor II

SIP is the main difference so any parts that were writing into /System (or other SIP protected areas) will need to be replaced with something else. We're using config profiles for a lot of it now.

gachowski
Valued Contributor II

@kerickson

I saw that same issue with some testing I was doing... I never follow up as I thought the .pkg I was using was old... maybe not flat?

I was thinking that it looks like in El Capitain Apple has really cleaned up System Image Utility, and that I should test a building an Netinstall with a JSS quick add .pkg in it..

However that is a long term plan/option and I needed to focus on getting El Capitain and FileVault working...

C

KyleEricson
Valued Contributor II

This is what I tried on a 10.11 and nothing happened:

!/bin/sh

Created by Amsys

Use at your own risk. Amsys will accept

no responsibility for loss or damage

caused by this script.

Requires 10.10 or higher.

###

variables

###

PLBUDDY=/usr/libexec/PlistBuddy
KEYBOARDNAME="English"
KEYBOARDCODE="1"
LANG="en"
REGION="en_US"
SUBMIT_TO_APPLE=NO
SUBMIT_TO_APP_DEVELOPERS=NO

##################################################
### Advanced Modification Only Below This Line ###
##################################################
###

functions

###

update_kdb_layout() { ${PLBUDDY} -c "Delete :AppleCurrentKeyboardLayoutInputSourceID" "${1}" &>/dev/null if [ ${?} -eq 0 ] then ${PLBUDDY} -c "Add :AppleCurrentKeyboardLayoutInputSourceID string com.apple.keylayout.${KEYBOARDNAME}" "${1}" fi

for SOURCE in AppleDefaultAsciiInputSource AppleCurrentAsciiInputSource AppleCurrentInputSource AppleEnabledInputSources AppleSelectedInputSources do ${PLBUDDY} -c "Delete :${SOURCE}" "${1}" &>/dev/null if [ ${?} -eq 0 ] then ${PLBUDDY} -c "Add :${SOURCE} array" "${1}" ${PLBUDDY} -c "Add :${SOURCE}:0 dict" "${1}" ${PLBUDDY} -c "Add :${SOURCE}:0:InputSourceKind string 'Keyboard Layout'" "${1}" ${PLBUDDY} -c "Add :${SOURCE}:0:KeyboardLayout ID integer ${KEYBOARDCODE}" "${1}" ${PLBUDDY} -c "Add :${SOURCE}:0:KeyboardLayout Name string '${KEYBOARDNAME}'" "${1}" fi done
}

update_language() { ${PLBUDDY} -c "Delete :AppleLanguages" "${1}" &>/dev/null if [ ${?} -eq 0 ] then ${PLBUDDY} -c "Add :AppleLanguages array" "${1}" ${PLBUDDY} -c "Add :AppleLanguages:0 string '${LANG}'" "${1}" fi
}

update_region() { ${PLBUDDY} -c "Delete :AppleLocale" "${1}" &>/dev/null ${PLBUDDY} -c "Add :AppleLocale string ${REGION}" "${1}" &>/dev/null ${PLBUDDY} -c "Delete :Country" "${1}" &>/dev/null ${PLBUDDY} -c "Add :Country string ${REGION:3:2}" "${1}" &>/dev/null
}

#########

Script Commands

#########

Create a local admin user account

sysadminctl -addUser localadmin -fullName "Administrator" -UID 499 -password "password" -home /var/localadmin -admin

Set the time zone to Central DST

/usr/sbin/systemsetup -settimezone "Central Standard Time"

Enable network time servers

/usr/sbin/systemsetup -setusingnetworktime on

Change Keyboard Layout

update_kdb_layout "/Library/Preferences/com.apple.HIToolbox.plist" "${KEYBOARDNAME}" "${KEYBOARDCODE}"

for HOME in /Users/ do if [ -d "${HOME}"/Library/Preferences ] then cd "${HOME}"/Library/Preferences HITOOLBOX_FILES=find . -name "com.apple.HIToolbox.plist" for HITOOLBOX_FILE in ${HITOOLBOX_FILES} do update_kdb_layout "${HITOOLBOX_FILE}" "${KEYBOARDNAME}" "${KEYBOARDCODE}" done fi
done

Set the computer language

update_language "/Library/Preferences/.GlobalPreferences.plist" "${LANG}"

for HOME in /Users/ do if [ -d "${HOME}"/Library/Preferences ] then cd "${HOME}"/Library/Preferences GLOBALPREFERENCES_FILES=find . -name ".GlobalPreferences.plist" for GLOBALPREFERENCES_FILE in ${GLOBALPREFERENCES_FILES} do update_language "${GLOBALPREFERENCES_FILE}" "${LANG}" done fi
done

Set the region

update_region "/Library/Preferences/.GlobalPreferences.plist" "${REGION}"

for HOME in /Users/ do if [ -d "${HOME}"/Library/Preferences ] then cd "${HOME}"/Library/Preferences GLOBALPREFERENCES_FILES=find . -name ".GlobalPreferences.plist" for GLOBALPREFERENCES_FILE in ${GLOBALPREFERENCES_FILES} do update_region "${GLOBALPREFERENCES_FILE}" "${REGION}" done fi
done

Enable SSH

systemsetup -setremotelogin on

Configure Login Window to username and password text fields

/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool true

Disable iCloud for logging in users

osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
sw_vers=$(sw_vers -productVersion)

for USER_TEMPLATE in "/System/Library/User Template"/* do /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant GestureMovieSeen none /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant LastSeenCloudProductVersion "${sw_vers}" /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant LastSeenBuddyBuildVersion "${sw_build}" done

for USER_HOME in /Users/* do USER_UID=basename "${USER_HOME}" if [ ! "${USER_UID}" = "Shared" ] then if [ ! -d "${USER_HOME}"/Library/Preferences ] then mkdir -p "${USER_HOME}"/Library/Preferences chown "${USER_UID}" "${USER_HOME}"/Library chown "${USER_UID}" "${USER_HOME}"/Library/Preferences fi if [ -d "${USER_HOME}"/Library/Preferences ] then /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant GestureMovieSeen none /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant LastSeenCloudProductVersion "${sw_vers}" /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant LastSeenBuddyBuildVersion "${sw_build}" chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.apple.SetupAssistant.plist fi fi done

Disable diagnostics at login

if [ $osvers -ge 10 ]; then CRASHREPORTER_SUPPORT="/Library/Application Support/CrashReporter" CRASHREPORTER_DIAG_PLIST="${CRASHREPORTER_SUPPORT}/DiagnosticMessagesHistory.plist"

if [ ! -d "${CRASHREPORTER_SUPPORT}" ]; then mkdir "${CRASHREPORTER_SUPPORT}" chmod 775 "${CRASHREPORTER_SUPPORT}" chown root:admin "${CRASHREPORTER_SUPPORT}" fi

for key in AutoSubmit AutoSubmitVersion ThirdPartyDataSubmit ThirdPartyDataSubmitVersion; do $PlistBuddy -c "Delete :$key" "${CRASHREPORTER_DIAG_PLIST}" 2> /dev/null done

$PlistBuddy -c "Add :AutoSubmit bool ${SUBMIT_TO_APPLE}" "${CRASHREPORTER_DIAG_PLIST}" $PlistBuddy -c "Add :AutoSubmitVersion integer 4" "${CRASHREPORTER_DIAG_PLIST}" $PlistBuddy -c "Add :ThirdPartyDataSubmit bool ${SUBMIT_TO_APP_DEVELOPERS}" "${CRASHREPORTER_DIAG_PLIST}" $PlistBuddy -c "Add :ThirdPartyDataSubmitVersion integer 4" "${CRASHREPORTER_DIAG_PLIST}"
fi

Disable Time Machine Popups offering for new disks

/usr/bin/defaults write /Library/Preferences/com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true

Turn off Gatekeeper

spctl --master-disable

Turn on right-click for mouse and trackpad

for USER_TEMPLATE in "/System/Library/User Template"/* do /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.driver.AppleHIDMouse Button2 -int 2 /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string TwoButton /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -int 1
done

for USER_HOME in /Users/* do USER_UID=basename "${USER_HOME}" if [ ! "${USER_UID}" = "Shared" ] then if [ ! -d "${USER_HOME}"/Library/Preferences ] then mkdir -p "${USER_HOME}"/Library/Preferences chown "${USER_UID}" "${USER_HOME}"/Library chown "${USER_UID}" "${USER_HOME}"/Library/Preferences fi if [ -d "${USER_HOME}"/Library/Preferences ] then killall -u $USER_UID cfprefsd /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.driver.AppleHIDMouse Button2 -int 2 /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string TwoButton /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -int 1 fi fi
done

Read My Blog: https://www.ericsontech.com

davidacland
Honored Contributor II

There are a few things that have changed in 10.11 so this script won't work properly on anything other than 10.10.

We (Amsys) are currently working on our 10.11 first boot script. We have a working version but its not quite ready for the public eyes of github ;)