One-off macOS bootstrap script for setting up tools, Oh My Zsh, and shell config.
- Homebrew (if missing)
- Homebrew formulae: python, fzf, kubernetes-cli, kubectx, colima, docker, docker-buildx, minikube, jq, yq, ripgrep, fd, bat, k9s, helm, hashicorp/tap/terraform, awscli, kubie
- Homebrew cask: gcloud-cli
- Oh My Zsh
- kubectl aliases file from ahmetb/kubectl-aliases
cd bootstrap-mac./install.sh(or./bin/bootstrap-mac)
Common options:
./install.sh --backup(backup.zshrcand.zshrc.local)./install.sh --dry-run./install.sh --only brew./install.sh --skip ohmyzsh./install.sh --only docker./install.sh --use-brewfile./install.sh --lock(generateBrewfile.lock.jsonwhen using Brewfile)./install.sh --verify./install.sh --check./install.sh --list./install.sh --force./install.sh --uninstall
These only apply if your machine blocks Homebrew writes (common on managed Macs or older setups).
-
Ensure Xcode Command Line Tools are installed (the installer will prompt if missing):
xcode-select --install -
If Homebrew reports permission errors (e.g.,
/usr/localor~/Library/Caches/Homebrewnot writable), fix ownership and permissions:
sudo chown -R "$(whoami)" \
"$HOME/Library/Caches/Homebrew" \
"$HOME/Library/Logs/Homebrew" \
/usr/local
sudo chmod u+w \
"$HOME/Library/Caches/Homebrew" \
"$HOME/Library/Logs/Homebrew" \
/usr/local /usr/local/*If your machine is MDM-managed and chown fails with “Operation not permitted,” you may need IT to grant write access or migrate Homebrew to /opt/homebrew.
~/.zshrcwill setZSH_THEME="gentoo"and source~/.zshrc.local.~/.zshrc.localwill contain fzf integration, fzf git extension, kubectl completion, kubectx/kubens aliases, kubectl alias pack, gcloud PATH + completion,CLOUDSDK_PYTHON, and an optional personal include (~/.zshrc.personal).~/.fzf-git.shwill be installed for git-specific fzf shortcuts.~/.docker/config.jsonmay be updated to include the Homebrew Docker CLI plugin directory for buildx.
config.shlets you override defaults (formulae, casks, Zsh theme).- You can also split overrides into
config/brew.sh,config/zsh.sh,config/docker.sh, andconfig/terminal.sh. Brewfileis available forbrew bundleinstalls.- You can override the theme via
ZSH_THEME=gentoo ./install.sh.
The installer applies the Terminal profile by default.
Files:
config/terminal/Bootstrap.terminal(placeholder profile file)config/terminal.sh(profile name + path)lib/terminal.sh(optional helper functionconfigure_terminal_profile)
How to set it up:
- In Terminal, create a profile with your preferred settings (size 160x40, font size 14, opaque background).
- Export the profile to
config/terminal/Bootstrap.terminal(replace the placeholder file). - Run the installer (or
./install.sh --only terminal) to import it and set it as the default.
install.sh: Main installer (idempotent).bin/bootstrap-mac: Convenience wrapper for the installer.lib/: Modularized installer functions (brew, zsh, docker, verify, helpers).config.sh: Optional overrides for the installer.config/: Optional config fragments by concern.config/terminal/: Placeholder Terminal profile (replace with your exported profile).Brewfile: Optional declarative Homebrew bundle.scripts/lint.sh: Shellcheck + shfmt helper (optional).tests/test-local.sh: Runs the installer with stubs in an isolated test HOME.tests/test-docker.sh: Builds a container and runs the same local test inside it.tests/Dockerfile: Minimal container for the test harness.tests/README.md: How the test harness works.tests/stubs/: Fakebrewandcurlused by tests to avoid system changes.tests/test-home/: Generated test HOME directory (created on each test run).tests/test-local.log: Generated log fromtests/test-local.sh.install.log: Optional run log if you pipe output to a file.
The test harness is Linux-based and validates script logic and config output. It does not perform real Homebrew installs.
- Local test (no Docker):
./tests/test-local.sh - Docker test (builds container, runs tests, removes container and image):
./tests/test-docker.sh
- After installation, open a new terminal or run
source ~/.zshrc. - Start Colima with
colima startwhen you need Docker. - Initialize gcloud with
gcloud init. - Start minikube with
minikube startwhen needed. --uninstallonly removes the managed Zsh block; it does not uninstall tools.- Optional: install
shellcheckandshfmtif you wantscripts/lint.shto run locally.