AppleScript/Automator Workflow to restore OS X to "mint" condition

Under Mountain Lion, I wanted to create an AppleScript that would essentially restore my OS X install to "mint" condition, if possible even to the point of showing you the ML welcome screen asking you for your name and timezone, yet preserving the apps I have installed, but remove any settings, configurations, or state. (I wanted to create an image I can re-use later with out any of the temp files, settings, or customizations).

Is this or something close-to possible?


I don't know what I keep on forgetting about Automator. Excellent idea.

You can try removing a setup file to flag configuration:

in

/var/db

--w----r--   1 root        wheel             0  1 Nov 12:51 .AppleSetupDone

Remove that file and I believe that the setup will happen next boot.

By the way, I think you might want to look into the system image tool

man asr

Here we have a slightly different way of looking at imaging, possible since Lion.

YMMV, of course.

EDIT: Also, you could just create a new user.
That user will have default preferences.

defaults domains

will give you the pristine preferences, space delimited.

Any of your old user's prefs that are not in the set of the new user prefs should be the ones you want to get rid of.

Also, you can run

defaults read

on the new user and save that to a file. That will be the default preferences for an account.

Don't forget about the ByHost settings... I think you want to delete those to reset.