MacOS – How to re-run the initial Setup Assistant on Mountain Lion

macossetup-assistantterminal

As described in my write-up on custom keyboard layouts, in some situations it can be useful to re-run the Setup Assistant (the app that you get when you start a new Mac for the first time, or do a fresh OS X install) to change some settings for the current user.

This used to work fine in OS X 10.7 Lion and earlier versions:

sudo "/System/Library/CoreServices/Setup Assistant.app/Contents/MacOS/Setup Assistant"

However, in OS X 10.8 Mountain Lion, this command exits early with the following message:

…System identity already exists for domain com.apple.systemdefault. Done.

It seems the Setup Assistant has gotten “smarter” in that it detects all the settings for the current user have already been entered. Is there any way to bypass this detection so I can run the Setup Assistant again (to change the global system keyboard layout)?

Best Answer

Actually, you should be able to do it by removing a hidden system file which tells OS X that setup has run. Delete this file:

/var/db/.AppleSetupDone

It's a hidden file, so you will have to remove it using Terminal, or show hidden files in Finder. You can remove the file like so:

rm /var/db/.AppleSetupDone

To show hidden files in Finder, type the following into the Terminal:

defaults write com.apple.Finder AppleShowAllFiles -bool true

…and then restart Finder.