Copy entire user profile to new device with different username

My work MBP has been set up as a standalone device, but now needs to join the corporate network.

Is there a way to copy my entire user profile (apps, config, terminal settings etc) to a new device (the same device, having been wiped) with a different username? (e.g. domain\dunc)

The new user account will already be created on the "new" device, and I don't have the ability to change this.


Solution 1:

I have done the same thing a number of time for the same reasons.

In what follows I assume you are running macOS High Sierra or later. If that were not the case, some paths and preference pane options might be different.

What I have found is that using the same Apple ID on both the old and the new machine/install already goes a long way. Just make sure to select Mail, Contacts, Calendars, Reminders, Safari, Notes and especially Keychains in System Preferences/iCloud on both machines. If desired you can enable the other items as well like iCLoud Drive, Photos etc.

This way you will be able to migrate your passwords, Safari bookmarks & history etc. Using the same Apple ID you will be able to re-download all apps you bought from the App Store as well.

If you are using Dropbox or similar, install those as well on the new machine/install. This way any file stored there will be available on the new box as well.

What's still missing is:

  • Documents (the ones not in iCloud Drive, Dropbox etc.)
  • Preferences
  • SSH keys
  • Any app not bought from the App Store
  • Any system-wide extension, VPN profile and the like.

To bring those over, what I suggest is the following. Log onto your old machine/install and backup (to an external drive or USB stick):

  • Your home directory (/Users/"username")
  • /Library
  • /Users/Shared (if not empty)

A Time Machine backup would be more complete and definitely preferable.

On the new machine/install, under your new account:

  • Re-install your old apps (re-download them if necessary).
  • Copy the directories Application Support, Fonts and Preferences from "your old home directory"/Library/ to "your new home directory"/Library/
  • Do the same with any app-specific directory you find there.
  • Display hidden files in your old home directory using the Finder (Command + Shift + .) and copy .ssh, .local and any app specific files and directories over (e.g. .vim/ and .vimrc).
  • Copy the content of the old /Users/Shared to the new machine.
  • Copy any file or directory over from the old /Library folder to the new one. This typically involves looking inside Application Support, Extensions and Fonts in there.

Application-secific configs are typically stored in your home directory, inside Library/Preferences and/or Library/Application Support. To copy those over you have two choices:

  • Copy the whole Library/Preferences and Library/Application Support directories from your old home to the new account.
  • Selectively copy the files and directories from those two locations over to the new account.

My preferences is for the latter option as I like to keep things clean.

Some notes and warnings: messing with /Users/Shared and especially /Library/Extensions is not usually necessary. Please do it only if you know what you are doing as you could mess up your new machine.

For the next time, you might want to look into automating the setup of a new macOS machine. There are a number of ways to do that. One I use if having your own dotfiles.

Most of the files you will be copying over using the procedure outlined above are not tied to your username. There are a handful of exceptions however (mostly your shell config and history).

If you are familiar with the Terminal you can use grep to find them (e.g. find $HOME -exec grep $USER {} \; -print on the old machine when logged in as your old account).

Finally, the list above is probably not complete. However you should be able to adapt it to cover your needs.

Good luck!