How do I copy (or clone or duplicate or make a template) user account?

In Mac OS X Lion (10.7.3), is it possible to create a new user account with settings identical to an existing user account? Or put another way, is it possible to set-up a user account template? I do not want to duplicate all of my documents, music, and photos. Rather I would just like to create a new user account that has all / most of the settings and preferences that I have customized and tweaked over many months in my existing account.

My goal is to maintain two separate accounts: one for personal use and one for work use. My office shares files over Dropbox, and I'd like to sync all those on my Mac, but I'd rather not intermingle them with my personal documents.

I've seen a few suggestions online that use Terminal to copy my existing account's home folder to a new directory with a different shortname. But (1) that solution might be outdated, and (2) it seems like it might duplicate documents, music, and photos.


Solution 1:

I realise you are not looking to duplicate all of your files, but this method is quick and at the end you can just delete the files you don't want on the new account. To create a duplicate account based on the settings of your current account, try this:

  1. Making a Time Machine backup of the current account.

    No extra disk for backing up? Go to Disk Utility and create a partition on your current disk. Assuming you have space (I will, since you are looking to add an additional user account), you can add a partition to your startup disk without losing any data (you can also remove it or change the size after you are done). Make this new partition your Time Machine backup disk.

  2. Launch the Migration Assistant utility (search for it in Spotlight).

  3. In Migration Assistant, indicate that you want to import settings from a Time Machine backup.
  4. In Migration Assistant, select to import the user account from the backup.
  5. Because the name is the same as your current account, Migration Assistant will prompt you to rename the account.
  6. Continue the migration and your new user account will be made–a duplicate of the current account except for the username.

I'm doing this right now in Lion and it is working a treat. Good luck.

Solution 2:

Mac OS X has a template for users, it's located in /System/Library/User Template/.lproj (in most cases, will be English.) In that folder, there's the whole basic structure of a user directory.
These folders only can be read/written by root, so you have to access it in a root shell.

If you want to use the "copy home directory method", you could do this:
1. Create a new user.
2. Copy the sub-folders you need of your current ~/Library to the new one; especially you'll probably need to copy the folders Application Support (data from apps) and Preferences (app preference files), and delete unwanted stuff from it afterwards.

Hope I could help...

Solution 3:

You should be aware that the methods stated so far can cause trouble with the new user account if there is configuration that explicitly references the users home directory.

For instance, after cloning the a user with the 'Migration Assistant' from the Time Machine backup I ran into the Google updater executing in an infinite loop because it looked for a file in the initial users ("xxx") home directory:

Could not find and/or execute program specified by service: 2: No such file or directory: /Users/xxx/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/GoogleSoftwareUpdateAgent.app/Contents/MacOS/GoogleSoftwareUpdateAgent

I suspect there is no generic solution to this. This particular problem could be solved e.g. by executing

> ~/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/GoogleSoftwareUpdateAgent.app/Contents/Resources/ksinstall --uninstall

in the command line of the cloned user account, which uninstalls the updater (see also http://wireload.net/products/guu-google-update-uninstaller/ for older versions of the updater).