Is there any way to save Mac OS X preferences into a shell file?
The System Preferences appear to be stored in various places, depending on whether they are user or system specific. A lot of them are stored in either /Library/Preferences/ or $HOME/Library/Preferences/ (for per-user settings). But each preference pane will have its own way of storing them.

You can see which preferences are stored this way by typing:

defaults read &lt;domain&gt;


Where &lt;domain&gt; is either the start of the filename in your per-user system preferences, or the full path to a .plist file. For example:

defaults read com.apple.screensaver
defaults read /Library/Preferences/com.apple.screensaver


The former will show your per-user customisation of the screensaver settings, while the latter will show the system screensaver settings.

The settings are largely organised by preference pane, though not necessarily that straight forward. You'll likely have to poke around in /Library/Preferences and sub-folders (especially SystemConfiguration) to find them all.

One option would be to just copy the relevant files out, and put them back in place for new installations.

Another way would be to export and import it as required.

Exporting the Power Management (Energy Saver) System Preferences to pm.plist:

defaults export /Library/Preferences/SystemConfiguration/com.apple.PowerManagement pm.plist


Importing those preferences from pm.plist on the new computer:

defaults import /Library/Preferences/SystemConfiguration/com.apple.PowerManagement sysprefs.plist


You may even want to edit the various exported .plist files if there are specific system preferences you do/don't want to share between computers. That way you can have some customisation locally, and the import command will not overwrite those, just add the ones you've set in the .plist files. You can use the defaults command to modify your own .plist files as well (but make sure you specify the full path to the file, not just a name, or you may be modifying your per-user preferences).