My Macbook Air is nearing the end of its life and I’m in the process of migrating to a new machine. I’ve been wanting to learn more about bash scripting so instead of looking for existing solutions, I built a set of scripts to backup and restore my dotfiles, apps, and system settings. I thought I’d share it here in case it’s helpful to anyone.
I think of these scripts as a moving van for your Mac setup. It backs up the files and settings you care about—your dotfiles, VS Code, iTerm settings, and macOS preferences—and makes restoring them as simple as running a script.
Here’s what it can do:
Save all your important dotfiles (think .zshrc
, .gitconfig
, etc.), while skipping unnecessary junk like cache directories or oversized files.
Tooling & apps:
keybindings.json
and settings.json
.MacOS system settings:
Every backup is saved in a clean, timestamped folder for easy tracking (e.g., dotfiles/20230118_123456
). No more guessing which backup is the latest.
When you’re ready to set up your new Mac, restoration is a breeze. Dotfiles go back to their original locations, app settings are reinstated, and system preferences are reloaded with a single script.
On your old Mac, run the backup scripts:
./backup-dotfiles.sh
./backup-system-settings.sh
This will create a timestamped folder with all your dotfiles, app settings, and macOS preferences.
Move the backup folder to your new Mac (via external drive, cloud storage, or however you roll).
On your new Mac, run the restoration scripts:
./restore-dotfiles.sh
./restore-system-settings.sh
That’s it. Your setup is back.
There’s something satisfying about configuring a fresh system from scratch, but these days I’ve found myself valuing efficiency over ceremony. The sooner I can get my environment set up, the sooner I can focus on meaningful work.
In hindsight, I could’ve used Time Machine to backup everything but I like this approach because it gives me more control over what I want to keep. This is especially useful when I’m low on disk space.
The code is available on GitHub, although I wouldn’t recommend using it as is. It still needs some work and is tailored to my specific setup, but I thought I’d share it here in case it’s helpful to anyone.
This project is still brewing…I’m resisting the urge to build a minimal little frontend for this—complete with toggles, size limit sliders, animations, etc. It feels like a fun excuse to learn more about SwiftUI.
Might revisit this in the future…