Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Denis Kugappi 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. –  Denis Kugappi 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
show 1 more comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.