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?

  • Why an AppleScript? And why exactly do you want to do this? – Gerry Oct 9 '12 at 16:27
  • I basically want to create a "factory" image but with a predefined set of apps already installed. Typically I would just remove everything in Library –> Preferences folder but that doesn't seem to be a catch-all method. – dkugappi Oct 9 '12 at 16:27
  • If you want to create a live image, you don’t need an AppleScript. There is some stuff that you can change to make a live CD. I know it because I own a kind of Recovery HD, though I downloaded that instead of making it myself so I don’t know how to do that. But definitely, an AppleScript is not the right solution. – duci9y Oct 9 '12 at 16:30
  • I have a recovery image, that's fine. I wanted to get it to a state where it's clean. So basically a solution (whether it be an app or simply a script) that would know which folders contain files outside of the "default" install and remove them. – dkugappi Oct 9 '12 at 16:37
  • This is a great idea actually.I wish I had read this 3 days ago. – chiggsy Nov 15 '12 at 17:16

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

You can try removing a setup file to flag configuration:



--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.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .