macOS Backup Migrate System Preferences

Scenes

I don’t know if you have encountered such a scenario when using macOS: There are two computers, and you want to migrate (import) the system preference settings from the old computer to the new computer, only care about these settings, and don’t want to migrate other thing.

solve

Option 1: Official Migration Assistant

In fact, the official provides a solution called "migration assistant". The specific operation steps can be seen in the document: Migrating content to a new Mac can not only migrate system settings, but also files, applications, etc. under the entire user account.

As shown in the figure, we can only select "System and Network" in this step to realize the migration of system settings.

Option 2: macprefs

The first solution is actually a safer approach, but it should be noted that:

In this example, John Appleseed is a macOS user account. If this account has the same name as an account already on the new Mac, you will be prompted to rename the old account or replace the account on the new Mac. If renamed, the old account will appear on the new Mac as a separate user with a separate home folder and login. If you do, the old account will delete and then replace the account on the new Mac, including everything in the corresponding home folder.

That means you can choose to overwrite or create another account to migrate your data. In fact, many times, we just want to export and import the system preferences, that's all, and we don't want to involve account-related operations. Another example is that I want to share my settings with other friends, or back them up to my own hard drive or cloud. At this time, you need to use the power of open source.

macprefs:Backup and Restore your Mac System and App Preferences (e.g. defaults write)

The About of this open source project is very clear, that is, it can backup and restore the system settings of macOS. It is also very easy to install and use:

brew install clintmod/formulas/macprefs

Open the terminal and install with one line command. Don't have brew installed? The official website is here: https://brew.sh/

Backup and restore commands:

macprefs backup
# 备份成功之后,文件默认在~/Dropbox/MacPrefsBackup目录中
macprefs restore

Of course, you can also modify the default backup directory:

export MACPREFS_BACKUP_DIR="$HOME/SomeOtherDir"

Therefore, we can backup the files on the old computer, copy the files to the new computer, and then restore them. Obviously the premise is that macprefs is installed on both sides. It should be noted here that it is best to ensure that the account usernames on both sides are the same, otherwise strange problems may occur (test with tears).

Solution 3: mackup

An introduction to this open source project: Keep your application settings in sync (OS X/Linux)

The difference from solution 2 is that it directly backs up the system settings to the cloud, and Dropbox needs to be installed first , which is equivalent to saving the operation of manually copying files to another computer. Then install this tool:

brew install mackup

Backup and restore commands:

mackup backup
mackup restore

Another advantage over macprefs is that it can undo restore operations:

mackup uninstall

That is to say, if I find a problem after the restore, such as a strange bug, then I can undo the original settings, giving people a feeling of peace of mind. In addition, mackup not only supports macOS, but also supports other Linux distribution systems such as Ubuntu.

Option 4: Pure manual transmission

In fact, after exploring and discovering, we know that macOS will store some of the user's App settings here: /Users/xxx/Library/Preferences, and store system-related settings here: /Library/Preferences.

In fact, the above-mentioned open source tools generally back up these files. From part of the source code of macprefs, we can know:

def get_preferences_dir():
    return_val = path.join(get_home_dir(), 'Library/Preferences/')
    return return_val

In theory, we can manually copy these folders in the past. I haven't personally tested this. After all, the actual operation granularity may not be so coarse. Interested friends can try it out.

Afterword

Someone mentioned the method of backing up and restoring directly to Time Machine before, which is a bit of a big deal. I just want to migrate the system preferences, especially the fine-tuning of touchpad, mouse, keyboard and other settings. It is very troublesome to do it again every time I change computers. I also hope that the official has an easier way to export these configuration files. After all, open source tools are not updated in time, and problems are likely to occur.

Guess you like

Origin blog.csdn.net/ysy950803/article/details/114044098