How to backup only the settings from a MacBook Pro

I am totally aware of Time Machine and the process of backing up the complete Mac data on an external Hard drive.

I just need to generate a small script/backup of all the settings of my MacBook pro.

I just need the ability to run that script in a new machine, and that can download and install all the apps & configure things like the menu bar, dock settings, etc.

This is something like composer does for a PHP project.

Is there a way to that in MacBook Pro?


Solution 1:

I'm not sure there's anything simple/comprehensive. I've been working on this myself for the past few months. I'm pretty happy with what I've got, but I had to put in a lot of custom work to draw together a lot of individual pieces.

The exact answer depends very much on what sort of config you need to port, and how technical you are. If you're talking about common color/desktop settings, this shouldn't be too bad. If you're trying to do something complex like keep exact Finder view preferences for every folder on your system, you're in for some work.

Here are a few things you may want to look into, each of which can get you at least part of what you want (listed roughly from less to more complex/technical)

  • mackup, a program which recognizes config files for many apps and attempts to piggyback on sync software such as Dropbox to share them among systems (I haven't used this--just aware it exists...; this is probably as close as you'll get if you'll get to what you're asking without doing some custom scripting)
  • A simple package manager, such as homebrew (particularly via brew bundle, which can install apps and other software specified in a Brewfile)
  • a dotfile manager, (I use yadm--but there are many of these with slightly different features and philosophies), which provides a scaffold for identifying which files on your system are config related, and making it simple to track/port them to another system. For the most part, you'll be on your own to identify what is worth tracking with one of these. It tends to take a while to identify what files are useful config, and which ones are junk. Many apps mingle them.
  • publicly posted dotfile repos from other mac users. One of the most famous of these is by Mathias Bynens. Some dotfile repos will only be good for ideas, but some (Like Mathias') include instructions for how you could install his configuration on your own system. It'll probably still take a good bit of effort to tailor this to your own needs.
  • more complex package managers such as Nix which, in tandem with nix-darwin, is capable of setting up parts of a macos system in a fairly deterministic/explicit/repeatable manner.

To give you some sense of what this can look like in practice, I can stand up a new system in under two hours with the vast majority of what I need pre-configured/installed. The process is, roughly:

  1. I start up the system and log in to a private git host for my dotfiles, and go check the installation instructions in my README file.

  2. Manually grant some security/privacy exceptions for Terminal and ScriptEditor so that my scripts can run.

  3. Copy/paste a small bash script from my README document which installs the Nix package manager, and uses Nix to install the software that my dotfile manager (yadm) needs to successfully clone my dotfiles.

  4. When yadm is done copying in my dotfiles, it automatically runs my full bootstrap script, which installs homebrew for installing a few big/commercial mac apps, installs nix-darwin for configuring the rest of my development-oriented software, sets many macos preferences, restores my work/project files from a remote backup repository, and runs hand-written scripts to configure a few apps that must be actively configured (installing Safari extensions, installing vpn configs, etc.)

  5. reboots the system for use