Skip to content

sambird-io/bootstrap-mac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bootstrap Mac

One-off macOS bootstrap script for setting up tools, Oh My Zsh, and shell config.

What It Installs

  • 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

Usage

  1. cd bootstrap-mac
  2. ./install.sh (or ./bin/bootstrap-mac)

Common options:

  • ./install.sh --backup (backup .zshrc and .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 (generate Brewfile.lock.json when using Brewfile)
  • ./install.sh --verify
  • ./install.sh --check
  • ./install.sh --list
  • ./install.sh --force
  • ./install.sh --uninstall

Manual Prereqs (If Needed)

These only apply if your machine blocks Homebrew writes (common on managed Macs or older setups).

  1. Ensure Xcode Command Line Tools are installed (the installer will prompt if missing): xcode-select --install

  2. If Homebrew reports permission errors (e.g., /usr/local or ~/Library/Caches/Homebrew not 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.

What It Changes

  • ~/.zshrc will set ZSH_THEME="gentoo" and source ~/.zshrc.local.
  • ~/.zshrc.local will 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.sh will be installed for git-specific fzf shortcuts.
  • ~/.docker/config.json may be updated to include the Homebrew Docker CLI plugin directory for buildx.

Configuration

  • config.sh lets you override defaults (formulae, casks, Zsh theme).
  • You can also split overrides into config/brew.sh, config/zsh.sh, config/docker.sh, and config/terminal.sh.
  • Brewfile is available for brew bundle installs.
  • You can override the theme via ZSH_THEME=gentoo ./install.sh.

Terminal Profile (Applied by Default)

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 function configure_terminal_profile)

How to set it up:

  1. In Terminal, create a profile with your preferred settings (size 160x40, font size 14, opaque background).
  2. Export the profile to config/terminal/Bootstrap.terminal (replace the placeholder file).
  3. Run the installer (or ./install.sh --only terminal) to import it and set it as the default.

Project Layout

  • 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/: Fake brew and curl used by tests to avoid system changes.
  • tests/test-home/: Generated test HOME directory (created on each test run).
  • tests/test-local.log: Generated log from tests/test-local.sh.
  • install.log: Optional run log if you pipe output to a file.

Testing

The test harness is Linux-based and validates script logic and config output. It does not perform real Homebrew installs.

  1. Local test (no Docker): ./tests/test-local.sh
  2. Docker test (builds container, runs tests, removes container and image): ./tests/test-docker.sh

Notes

  • After installation, open a new terminal or run source ~/.zshrc.
  • Start Colima with colima start when you need Docker.
  • Initialize gcloud with gcloud init.
  • Start minikube with minikube start when needed.
  • --uninstall only removes the managed Zsh block; it does not uninstall tools.
  • Optional: install shellcheck and shfmt if you want scripts/lint.sh to run locally.

About

One-off macOS bootstrap script for setting up tools, Oh My Zsh, and shell config.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages