Need a Fresh Start? Here's My Provisioning Script
Every now and then, I feel like my MacBook Pro just needs a fresh start. It’s nice to be back at square one—clean, fast, and distraction-free. Over time, I’ve streamlined the entire process with a provisioning script and a few practices that make getting back to work seamless.
Here’s how I do it.
Step 1: Back Up Development Files and Local Sites
Before wiping anything, I make sure all my dev work is backed up.
I use Resilio Sync to automatically back up my ~/Development folder, which holds all of my local projects. Once I reinstall, Resilio Sync pulls everything back down without any manual effort.
I also use DDEV to manage my local dev environments. Before reformatting, I create snapshots of all my active projects with:
ddev snapshot --all
These snapshots make restoring local databases and environments painless later on.
In addition to that, I copy over my .ssh folder, personal config files, and anything else I might need to a thumb drive that doubles as my macOS installer.
Step 2: Wipe and Reinstall macOS
I use a bootable macOS installer on a thumb drive. If you haven’t made one before, Apple’s guide walks you through the process.
Steps:
- Boot into macOS Recovery.
- Use Disk Utility to format the internal drive.
- Reinstall macOS from the thumb drive.
Step 3: Run My Provisioning Script
Once macOS is up and running, I open Terminal and run the script below. It checks for Homebrew, installs the CLI tools and apps I use daily, and even sets up Oh My Zsh.
It's a simple script, but it allows you to add/remove apps over time and make it your own.
#!/usr/bin/env bash
set -e
# Check for Homebrew, install if not present
echo "Checking for Homebrew..."
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to the shell profile
echo "Adding Homebrew to the shell profile..."
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Update and upgrade Homebrew
echo "Updating Homebrew..."
brew update
brew upgrade
# Install command-line tools
echo "Installing command-line tools..."
cli_tools=(
wget
git
git-lfs
git-flow
git-extras
ssh-copy-id
composer
node
cloudflared
)
for tool in "${cli_tools[@]}"; do
brew install "$tool"
done
# Update npm and install global npm packages
echo "Updating npm and installing global npm packages..."
npm install -g npm
npm install -g gulp-cli yarn
# Install applications
echo "Installing applications..."
cask_apps=(
1password
alfred
bambu-studio
docker
figma
firefox@developer-edition
google-drive
imageoptim
inkscape
iterm2
font-monaspace
openinterminal
phpstorm
private-internet-access
raspberry-pi-imager
rectangle
resilio-sync
sequel-ace
slack
sourcetree
the-unarchiver
transmit
vscodium
)
for app in "${cask_apps[@]}"; do
brew install --cask "$app"
done
# Clean up Homebrew
echo "Cleaning up Homebrew..."
brew cleanup
# Install Oh My Zsh
echo "Installing Oh My Zsh..."
if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fiYou can view the script here:
https://github.com/justin-peacock/macOS-provisioning
It includes:
- Installing Homebrew
- Installing CLI tools like
git,composer,node, andcloudflared - Installing global npm packages (
gulp-cli,yarn, etc.) - Installing GUI apps like iTerm2, Docker, Firefox Developer Edition, PhpStorm, Resilio Sync, and more
- Setting up Oh My Zsh
This is just an example of what works for me. You can easily modify it to suit your own workflow and tools.
Step 4: Sync Dev Files and Restore Projects
Once Resilio Sync is running, I start the sync for my ~/Development folder. Since all my projects live there, everything comes back exactly how I left it—no manual file transfers needed.
With the files synced, I can restore each DDEV environment by running:
ddev start
ddev snapshot restoreThat brings back both the project files and their databases, so I'm ready to start developing again.
Wrapping Up
Reformatting your Mac doesn’t have to be a time suck. With a good backup system, a reliable provisioning script, and some basic planning, I can go from a blank drive to a fully loaded dev setup in under an hour.
Questions? Suggestions? Hit me up—always down to hear how others are handling their local environments.