Skip to content

A script for setting up a new macos machine for my needs

License

Notifications You must be signed in to change notification settings

jneuendorf/mac-setup

Repository files navigation

mac-setup

A script for backing up some macOS configuration that can be restored on a blank macOS machine.

What's being backed up?

  • everything supported by Mackup
    • Homebrew is taken care of, i.e. the creation of a Brewfile
      • This includes applications managed by mas
  • VSCodium extensions
    • Only the list of extension names is backed up - not the extensions themselves.
  • macOS preferences
    • There are some limitations:
      • Only user preferences are backup, i.e. power management is missing, I believe
      • Only defaults is used. There may be other reasonable configrations that may be accessible differently (i.e. a different command or even using AppleScript (GUI programming)). I am open for additions (issues / pull requests).
  • Any other user files you want. See below.

Motivation

After having started writing TypeScript backup scripts and checking some resources on how to backup macOS defaults best, I accidentally bumped into this StackExchange Answer, which mentions Mackup and MacPrefs.

Running MacPrefs didn't work for me. Mackup worked well in principle and is actively maintained (big shout-out to @lra!), thus this project is heavily based on Mackup.

This project is an extension wrapper around Mackup. This way, arbitrary backup operations can be run before Mackup's backup is being run. Therefore, the backup is not limited to files being copied/linked, but files can be generated, for example. Also some more apps are supported and some apps are better supported (checkout the config files in src/configs/).

In addition, I didn't want to upload my backup to some cloud service but wanted a local copy in case backing up private data is required (even encryption would be pointless if the key is not backed up elsewhere...).

Furthermore, the backup can be restored without any prior user action, i.e. it does not require the user to install software before the backup can be restored.

Usage

Backup

⚠️ The following commands must be run from this project's root directory.

The backup script creates the folder ~/macos-backup in your home directory. This backup folder can be moved around (most likely it contains hidden files!) as it's self-contained for restoring it.

./backup
# Custom repo clone (i.e. if you have a fork yourself, please create a Pull Request ;) )
# - The clone must be executable in the same way as https://github.com/lra/mackup.git
./backup 'git@github.com:jneuendorf/mackup.git --branch enable_glob'

To specify additional personal files to be backed up run ./customize.sh. This creates custom.cfg and mackup.cfg in the current working directory and open's the former for editing (see the Mackup docs). The backup process then picks them up automatically.

You can save the backup directly on an external storage device by editing the mackup.cfg's path option, e.g. path = /Volumes/MyDrive.

Restore

Simply run ./restore.sh from the backup folder. Your root password will be required.

Related Projects / Used Resources

About

A script for setting up a new macos machine for my needs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published