brew bundle lets you snapshot every Homebrew CLI tool (Formula), macOS GUI app (Cask), Mac App Store app (mas), and VS Code or Cursor extension with a single brew bundle dump --force command—and bootstrap a fresh Apple Silicon MacBook dev environment in about five minutes using brew bundle install. Since Homebrew 4.5.0 (including 2026’s Homebrew 7.0), brew bundle ships built into core with no external tap required; to avoid errors on Apple Silicon, run Xcode Command Line Tools → /opt/homebrew/bin/brew shellenv PATH setup → Rosetta 2 (if needed) before restoring your Brewfile.Unboxing a brand-new MacBook is exciting—right up until you spend half a day hunting down installers, guessing which CLI tools you had on your old machine, and rebuilding your terminal, runtimes, desktop apps, and editor extensions from memory. Once you already know basic Homebrew usage, the highest-leverage upgrade to your workflow is moving from ad-hoc brew install notes to a declarative Brewfile brew bundle MacBook dev environment setup.
This guide walks through the modern Homebrew 7.0 workflow on Apple Silicon (M1–M5): how to capture a clean snapshot of your existing Mac, automate a five-minute bootstrap on a new machine, safely run brew bundle check and brew bundle cleanup without wiping critical apps, and resolve the five Apple Silicon issues that trip up most developers.
Why Use a Brewfile and brew bundle for MacBook Dev Environment Setup?
Keeping a scratchpad of brew install git and brew install --cask raycast commands inevitably leads to configuration drift—what is installed on your laptop quietly diverges from your notes within weeks. By contrast, a Brewfile—as documented in the Homebrew Brew Bundle and Brewfile documentation—treats your workstation like Infrastructure as Code, declaring the exact desired state of your machine in a single plain-text file.
A major milestone arrived in 2025 with Homebrew 4.5.0: the legacy third-party homebrew/bundle tap was deprecated and brew bundle was merged directly into Homebrew core. On Homebrew 7.0 in 2026, brew bundle works out of the box without running brew tap homebrew/bundle, and its scope goes far beyond standard formulae and casks to cover Mac App Store apps, VS Code and fork extensions, and language-specific global tools (uv, npm, go, and cargo).
| Brewfile Directive | What It Manages | Example Syntax | Restore Prerequisites & Notes |
|---|---|---|---|
tap | Third-party Homebrew repositories | tap "oven-sh/bun" | Declare at the top before formulae/casks from external taps |
brew | CLI tools & runtimes (Formula) | brew "ripgrep" | Installs natively under /opt/homebrew on Apple Silicon |
cask | macOS GUI apps & fonts (Cask) | cask "cursor" | Places apps in /Applications; legacy Intel apps need Rosetta 2 |
mas | Mac App Store apps | mas "Xcode", id: 497799835 | Requires mas CLI and an active Apple Account sign-in in App Store.app |
vscode | VS Code, Cursor & fork extensions | vscode "esbenp.prettier-vscode" | Searches PATH in order: code → codium → cursor → code-insiders |
uv / npm / go / cargo | Language-specific global CLI tools | uv "ruff" | Expanded in Homebrew 5.0–7.0; exclude with --no-uv, --no-npm, etc. |
Because a Brewfile is plain text, you can version-control it in a dotfiles Git repository, review diffs whenever you add a tool, keep personal and work MacBooks aligned, or drop a project-scoped Brewfile into a team repo to slash onboarding time for new engineers.
Step 1: Snapshot Your Current Mac with brew bundle dump
On your existing MacBook, brew bundle dump inspects what is currently installed and writes a ready-to-use Brewfile. In Homebrew 7.0, inline description comments above each entry are enabled by default (pass --no-describe for a compact file), and --force (-f) overwrites an existing Brewfile in place.
# 1) Install the mas CLI first if you want to back up Mac App Store apps
brew install mas
# 2) Dump formulae, casks, App Store apps, and editor extensions into ~/dotfiles
mkdir -p ~/dotfiles
brew bundle dump --force --file=~/dotfiles/Brewfile
# 3) Or save to Homebrew's global default path (~/.Brewfile or ~/.homebrew/Brewfile)
brew bundle dump --force --global
# 4) Dump a minimal Brewfile without comments or language-level global tools
brew bundle dump --force --no-describe --no-go --no-cargo --no-uv --no-npm \
--file=~/dotfiles/Brewfile
When you pass --global (-g), Homebrew resolves the file path in this order: $HOMEBREW_BUNDLE_FILE_GLOBAL → ${XDG_CONFIG_HOME}/homebrew/Brewfile → ~/.homebrew/Brewfile → ~/.Brewfile. Before committing your first dump to Git, take two minutes to prune one-off utilities you tried once and forgot about—keeping your Brewfile lean makes future restores noticeably faster and cleaner.
# ~/dotfiles/Brewfile (curated real-world example)
# 1. Core CLI tools & runtimes (Formulae)
brew "git"
brew "gh"
brew "ripgrep"
brew "fd"
brew "jq"
brew "fzf"
brew "mise"
brew "uv"
brew "mas"
# 2. Desktop developer & productivity apps (Casks)
cask "iterm2"
cask "raycast"
cask "visual-studio-code"
cask "cursor"
cask "orbstack"
cask "1password"
cask "font-jetbrains-mono-nerd-font"
# 3. Mac App Store apps (ADAM IDs via `mas list` / `mas search`)
mas "Amphetamine", id: 937984704
mas "Xcode", id: 497799835
# 4. Shared VS Code / Cursor extensions
vscode "esbenp.prettier-vscode"
vscode "dbaeumer.vscode-eslint"
vscode "eamodio.gitlens"
Managing Mac App Store Apps (mas) and VS Code / Cursor Extensions
- Finding
masApp IDs and sign-in requirements: According to the mas-cli official GitHub repository, Mac App Store apps are referenced by their numeric ADAM ID. Runmas listto inspect installed IDs ormas search "App Name"to look one up. Before runningbrew bundle installon a new Mac, open App Store.app and sign into your Apple Account first. - CLI lookup priority when using both VS Code and Cursor: Internally,
brew bundleresolvesvscodeentries by scanning your shellPATHin strict order:code→codium→cursor→code-insiders. If Cursor is your only editor and thecursorCLI is on yourPATH,vscode "..."lines natively back up and restore your Cursor extensions. If you run both VS Code and Cursor side by side,codewins every time—so either import extensions inside Cursor on first launch or track Cursor extensions explicitly with the two-liner below.
# Back up and restore Cursor extensions separately when VS Code is also installed
cursor --list-extensions > ~/dotfiles/cursor-extensions.txt
xargs -L 1 cursor --install-extension < ~/dotfiles/cursor-extensions.txt
Step 2: Automated 5-Minute Bootstrap Workflow for Apple Silicon Macs
Once you finish macOS Setup Assistant on a new Apple Silicon MacBook and open Terminal, run the idempotent bootstrap script below. Excluding multi-gigabyte downloads like full Xcode, the core CLI and Cask bootstrap pipeline finishes in roughly five minutes while strictly following the /opt/homebrew prefix recommended in the Homebrew Installation guide.
#!/usr/bin/env bash
set -euo pipefail
# 1) Install Xcode Command Line Tools first (provides git, clang, make)
if ! xcode-select -p >/dev/null 2>&1; then
echo "Installing Xcode Command Line Tools. Complete the macOS dialog to continue..."
xcode-select --install
until xcode-select -p >/dev/null 2>&1; do
sleep 5
done
fi
# 2) Install Homebrew natively for Apple Silicon (/opt/homebrew)
if ! command -v brew >/dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# 3) Persist /opt/homebrew in ~/.zprofile and load it into the current shell
if [[ -x /opt/homebrew/bin/brew ]]; then
grep -q '/opt/homebrew/bin/brew shellenv' ~/.zprofile 2>/dev/null || \
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# 4) Pre-install Rosetta 2 silently if any Brewfile casks still rely on x86_64 binaries
if [[ "$(uname -m)" == "arm64" ]] && ! /usr/bin/pgrep -q oahd; then
softwareupdate --install-rosetta --agree-to-license || true
fi
# 5) Restore everything in Brewfile (--no-upgrade preserves existing package versions)
brew bundle install --file="$HOME/dotfiles/Brewfile" --no-upgrade
# 6) Verify zero missing dependencies (include --no-upgrade so un-upgraded packages don't fail set -e)
brew bundle check --verbose --no-upgrade --file="$HOME/dotfiles/Brewfile"
If you share a single Brewfile between a work laptop and a personal MacBook, you do not need to maintain two separate branches just to skip a few apps. Pass space-separated skip lists via environment variables at install time to bypass heavy App Store downloads or personal apps on the fly.
# Skip specific Casks and Mac App Store IDs during a work MacBook restore
HOMEBREW_BUNDLE_CASK_SKIP="steam discord" \
HOMEBREW_BUNDLE_MAS_SKIP="497799835 937984704" \
brew bundle install --file=~/dotfiles/Brewfile
Safe Day-to-Day Maintenance with brew bundle check and cleanup
A Brewfile is not just a one-time migration tool—it shines during ongoing maintenance when you combine check, cleanup, and add/remove. That said, brew bundle cleanup treats every installed package missing from your Brewfile as a candidate for removal, so understanding its flags prevents painful surprises.
| Subcommand | Primary Role | Safe Flags & Practical Tips |
|---|---|---|
brew bundle dump | Export current machine state to a Brewfile | --force (overwrite), --no-mas / --no-vscode (omit categories) |
brew bundle install | Install missing entries & upgrade outdated ones | --no-upgrade (keep existing versions intact), --file=<path> |
brew bundle check | Verify all entries are satisfied (exit code 0 or 1) | --verbose (print missing items); ideal for CI or onboarding scripts |
brew bundle cleanup | Remove packages not listed in the Brewfile | Prompts before deleting by default; --force deletes immediately; watch --zap |
brew bundle add / remove | Edit Brewfile entries programmatically | e.g., brew bundle add --cask raycast avoids syntax typos |
Follow two safety rules whenever you run brew bundle cleanup:
- Never start with
--forceor--zap. Running plainbrew bundle cleanup --file=~/dotfiles/Brewfileshows you exactly what would be removed and prompts for confirmation first. Be especially cautious with--zap: beyond uninstalling an app bundle, it deletes~/Library/Application Supportdirectories and.plistpreference files, which can wipe local app data permanently. - Shield Mac App Store apps and editor extensions from cleanup. Pass
--no-mas --no-vscodeon the command line—or exportHOMEBREW_BUNDLE_CLEANUP_NO_MAS=1andHOMEBREW_BUNDLE_CLEANUP_NO_VSCODE=1in~/.zshrc—so a routine cleanup pass never accidentally strips out licensed App Store utilities or VS Code extensions you installed manually.
Apple Silicon brew bundle Troubleshooting Checklist
If you copy an older dotfiles repo written during the Intel Mac (/usr/local) era onto an M1–M5 MacBook, you will almost certainly hit one of these five snags. Here is how to fix each one cleanly.
1. zsh: command not found: brew (Missing /opt/homebrew in PATH)
To isolate ARM64 binaries cleanly, Homebrew installs into /opt/homebrew on Apple Silicon instead of /usr/local. If you skip the post-install shell snippet or open a fresh terminal without updating ~/.zprofile, macOS cannot locate brew. Append eval "$(/opt/homebrew/bin/brew shellenv)" to ~/.zprofile and run source ~/.zprofile. If you used Apple’s Migration Assistant from an Intel Mac, run which brew to confirm you are invoking /opt/homebrew/bin/brew rather than a leftover /usr/local/bin/brew binary.
2. Git and Source Build Failures from Missing Xcode Command Line Tools
On a freshly erased Mac, /usr/bin/git, clang, and make are lightweight shims that fail or trigger modal popups when a script tries to clone your dotfiles or compile a source-only formula. Always invoke xcode-select --install at the very top of your bootstrap script and wait until xcode-select -p returns /Library/Developer/CommandLineTools before running Homebrew commands.
3. Legacy x86_64 Casks Failing with “Requires Rosetta 2”
Most mainstream developer tools ship native ARM64 builds today, yet corporate VPN clients, peripheral drivers, and older GUI casks still rely on Intel binaries and abort brew bundle install with a Requires Rosetta 2 error. Running softwareupdate --install-rosetta --agree-to-license once during bootstrapping installs Rosetta 2 non-interactively and prevents mid-run interruptions.
4. Mac App Store “Redownload Unavailable” and mas Login Errors
Because of macOS security restrictions, mas cannot automate Apple Account authentication from the terminal, and automated downloads only succeed reliably for apps already linked to your Apple Account’s purchase history. Open App Store.app, verify you are signed in, and click “Get” once on any brand-new free app you have never downloaded before. On corporate machines where developers do not sign into personal Apple Accounts, keep mas entries out of the shared workflow using HOMEBREW_BUNDLE_MAS_SKIP or brew bundle dump --no-mas.
5. Legacy brew tap homebrew/bundle Errors on Homebrew 4.5.0+ and 7.0
Old Brewfile snapshots and setup scripts frequently include tap "homebrew/bundle" or brew tap homebrew/bundle. On Homebrew 4.5.0 and newer (including Homebrew 7.0), that tap is retired and triggers deprecation warnings or empty-tap failures. Simply delete the legacy tap line—brew bundle is already built into core Homebrew.
Frequently Asked Questions (FAQ)
Q. Does brew bundle install upgrade packages that are already installed on my Mac?
Yes—by default, brew bundle install installs missing items and also upgrades outdated packages already present on your system. If you only want to install missing dependencies without touching existing versions, pass --no-upgrade (for example, brew bundle install --no-upgrade) or set export HOMEBREW_BUNDLE_NO_UPGRADE=1 in your shell environment.
Q. Can brew bundle automatically back up and restore Cursor extensions in Homebrew 7.0?
Yes. In Homebrew 7.0, brew bundle searches your PATH in the order code, codium, cursor, and code-insiders, so on a Mac where Cursor is installed without VS Code, vscode "publisher.extension" directives back up and restore Cursor extensions automatically. If both VS Code and Cursor are installed, code takes precedence, so sync Cursor extensions separately with cursor --list-extensions and cursor --install-extension.
Q. Will brew bundle cleanup delete my Mac App Store apps or app preferences?
Running brew bundle cleanup without --force will not delete anything immediately; it lists candidate removals and asks for confirmation first. You can exclude App Store apps with --no-mas (or HOMEBREW_BUNDLE_CLEANUP_NO_MAS=1), and unless you explicitly add the --zap flag, Homebrew performs a standard uninstall that leaves your .plist settings and application support files intact.