The Developer Environment I Can Set Up in 30 Minutes on Any Machine
How I manage dotfiles, shell configs, and dev tools across 4 machines using Git and chezmoi — with the exact commands to clone and run.
TL;DR — Your entire developer environment — dotfiles, shell config, and dev tools — can be restored on any new machine in about 30 minutes using Git + chezmoi. Here are the exact commands to clone, bootstrap, and run, which I use to keep four machines in sync.
The Developer Environment I Can Set Up in 30 Minutes on Any Machine
Two things you'll learn: how to sync your entire dev environment across machines with one script, and why chezmoi beats raw dotfile Git repos for most people.
I wiped my MacBook in March. Clean install. No Time Machine.
The setup took 28 minutes. Here's exactly what I ran.
Why Most Dotfiles Setups Fail
Most dotfiles repos fail because they're either:
- Too personal: full of aliases only you use, no structure
- Too automated: massive install scripts that break on every OS update
- Not synced: one machine gets ahead, merge conflicts everywhere
The approach I settled on after 4 years solves all three: Git + chezmoi + one bootstrap script.
chezmoi is a dotfile manager that lets you store your config files in a Git repo, manage them with templates, and apply them to any machine with one command. It handles symlinks, private files (SSH keys, API tokens), and cross-platform differences automatically.
The Stack
| Layer | Tool | Why |
|---|---|---|
| Config storage | Git (private repo on GitHub) | Version control, portable |
| Dotfile manager | chezmoi | Templates, private files, cross-platform |
| Shell | zsh + starship | Performance + aesthetics |
| Terminal | iTerm2 | Split panes, tmux integration |
| Package manager | Homebrew | macOS;换成nix for Linux |
Step 1 — Initialize the Dotfiles Repo
On your current machine, install chezmoi and initialize it:
# Install chezmoi
brew install chezmoi
# Initialize chezmoi with your dotfiles repo
chezmoi init --source=$HOME/dotfiles
This creates $HOME/dotfiles/ as your source of truth.
Step 2 — Add Your Existing Config Files
# Add existing config files to chezmoi management
chezmoi add ~/.zshrc
chezmoi add ~/.gitconfig
chezmoi add ~/.config/starship.toml
chezmoi add ~/.config/nvim # if you use Neovim
# See what chezmoi is tracking
chezmoi source-status
Step 3 — Create a Private Config for SSH/Tokens
# Create a private directory (never committed to source)
mkdir -p ~/.local/share/chezmoi/private_dot_config
# Add SSH config (contains keys — never commit this)
chezmoi add ~/.ssh/config
# chezmoi automatically excludes private_dot_* from the public repo
Step 4 — Commit and Push
cd ~/.local/share/chezmoi
git remote add origin git@github.com:YOUR_USERNAME/dotfiles.git
git add .
git commit -m "Initial: zsh, git, starship, ssh"
git push -u origin main
Step 5 — The Bootstrap Script (Works on Any Fresh Machine)
This is the one script that sets up everything on a new machine:
#!/usr/bin/env bash
# bootstrap.sh — run on any fresh machine
set -euo pipefail
echo "Bootstrap starting..."
# 1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2. Install core tools
brew install chezmoi git zsh starship gh
# 3. Clone dotfiles repo (private)
git clone git@github.com:YOUR_USERNAME/dotfiles.git ~/.local/share/chezmoi
# 4. Apply all dotfiles
chezmoi apply --source=$HOME/.local/share/chezmoi
# 5. Install language runtimes (adjust to your stack)
brew install node python go
# 6. Set zsh as default shell
if [[ "$(which zsh)" != "$SHELL" ]]; then
echo "$(which zsh)" | sudo tee -a /etc/shells
chsh -s "$(which zsh)"
fi
echo "Done. Restart your terminal."
My Real .zshrc Aliases (Copy-Paste Ready)
These are the ones I actually use every day:
# ~/.zshrc — Mason's daily aliases
# Git (most-used)
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gcm='git commit -m'
alias gco='git checkout'
alias gl='git log --oneline -15'
alias gp='git push'
alias gpl='git pull --rebase'
alias gd='git diff'
alias gds='git diff --staged'
alias gcb='git checkout -b'
# npm/yarn/pnpm
alias ni='npm install'
alias nis='npm install -D'
alias nr='npm run'
alias nrd='npm run dev'
# Docker
alias d='docker'
alias dc='docker compose'
alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
# System
alias ll='ls -alF'
alias ..='cd ..'
alias ...='cd ../..'
alias edit zshconfig='nano ~/.zshrc'
# Quick commit + push
alias gpom='git add -A && git commit -m "quick save" && git push'
What Doesn't Work
NixOS / declarative config: I tried switching to Nix entirely. The learning curve is steep (Nix language is its own thing) and too much macOS software doesn't play nicely with it. I stick with Homebrew for macOS and only reach for Nix on Linux VMs.
Ansible for dotfiles: Overkill. Ansible is designed for server provisioning, not personal workstation setup. The syntax overhead isn't worth it for 20 config files.
Bare Git repo approach (git --git-dir=$HOME/.cfg --work-tree=$HOME): Works but doesn't handle private files, templates, or cross-platform differences. chezmoi solves all three.
Key Takeaways
- chezmoi is the right abstraction layer: templates for cross-machine differences, private files handled automatically, no custom install script needed
- One bootstrap script + one
chezmoi applyis all you need on a fresh machine — 28 minutes end-to-end - Private files (SSH, API tokens) live in a separate private repo or
private_dot_*directory in chezmoi — never committed to source - Sync is not the same as backup: chezmoi doesn't version your
node_modulesor build artifacts, just your configuration
Tools Used
| Tool | Link | Purpose |
|---|---|---|
| chezmoi | chezmoi.io | Dotfile manager with templates |
| Homebrew | brew.sh | Package manager (macOS) |
| zsh | Built-in | Shell |
| Starship | starship.rs | Cross-shell prompt |
| GitHub | github.com | Dotfiles repo hosting |
| iTerm2 | iterm2.com | Terminal emulator (macOS) |
I write Makerloop weekly — building with AI, career growth, and learning in public. Subscribe →
Did this article help you? If you're working through career direction, or want to use AI to work smarter, let's talk — I'm happy to help you think it through.
Let's talk →