This guide shows how to set up your dotfiles on a brand new, clean machine.
You need:
- Internet connection
- Your dotfiles git repository URL (e.g.,
https://github.com/yourusername/dotfiles.git)
That's it! Everything else will be installed automatically.
The one-line command installs things in this order:
get.chezmoi.ioscript → Downloads chezmoi as standalone binary (no Homebrew!)- chezmoi → Clones your dotfiles and runs setup scripts
- Setup scripts → Install Homebrew (Linux) or use existing (macOS)
- Homebrew → Installs all packages from Brewfile
Key insight: Chezmoi is installed as a standalone binary FIRST, so it doesn't need Homebrew to exist yet!
No prerequisites needed - works on completely fresh Mac:
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply yourusername/dotfilesThis installs chezmoi as a standalone binary (no Homebrew required), then chezmoi uses your existing Homebrew or installs packages.
If you want to install Homebrew yourself first:
# 1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2. Install chezmoi via Homebrew
brew install chezmoi
# 3. Run chezmoi
chezmoi init --apply https://github.com/yourusername/dotfiles.gitNote: This is longer but some prefer installing Homebrew manually first.
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply yourusername/dotfilesThat's it! This will:
- Download and install chezmoi as standalone binary (no Homebrew needed!)
- Clone your dotfiles repository
- Run all setup scripts automatically:
- Install Homebrew for Linux (chezmoi installs this for you!)
- Install essential system packages (zsh, libfuse2, etc.)
- Install all Homebrew packages from your Brewfile
- Change shell to zsh
- Set up all dotfiles
brew install chezmoi on fresh Linux - Homebrew doesn't exist yet! The get.chezmoi.io script installs chezmoi first, THEN chezmoi installs Homebrew.
# 1. Install chezmoi as standalone binary
curl -sfL https://git.io/chezmoi | sh
sudo mv ./bin/chezmoi /usr/local/bin/
# 2. Initialize and apply (this will install Homebrew)
chezmoi init --apply https://github.com/yourusername/dotfiles.gitDuring chezmoi init, you'll be asked:
Email address: your@email.com
This is stored in .chezmoi.toml and used for git configuration.
Then chezmoi will automatically:
✓ Clone dotfiles repository
✓ Install Homebrew (with dependencies)
✓ Install zsh, libfuse2, unzip via apt
✓ Install all Brewfile packages via Homebrew
→ git, node, bat, eza, fd, ripgrep, etc.
✓ Apply all dotfiles to ~
✓ Change shell to zsh
✓ Build bat cache
✓ Clone dotfiles repository
✓ Install all Brewfile packages via Homebrew
→ CLI tools: git, node, bat, eza, etc.
→ GUI apps: Alacritty, VSCode, VLC, etc.
→ Fonts: Fira Code Nerd Font, etc.
✓ Apply all dotfiles to ~
✓ Configure macOS defaults
✓ Change shell to zsh
✓ Build bat cache
- macOS: 10-15 minutes (depends on cask downloads)
- Linux: 15-20 minutes (Homebrew installation takes longer)
# Check chezmoi is working
chezmoi doctor
# Check Homebrew is installed
brew --version
# Check packages are installed
which git node bat eza fd rg
# Check dotfiles are applied
ls -la ~/ | grep zshrc# Reload shell to use zsh
exec zsh
# Or log out and back inOn Linux, you may need sudo for changing shell:
# Enter your password when prompted
sudo chsh -s $(which zsh) $USERIf brew command not found after install:
# Add to current session
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Then re-run
chezmoi applyThis is temporary - your .zshrc will handle it permanently.
If setup seems incomplete:
# Check what scripts ran
chezmoi execute-template --init --promptString "email=you@email.com"
# Force re-run scripts
chezmoi state delete-bucket --bucket=scriptState
chezmoi applyYour .chezmoi.toml remembers your email. To update it:
chezmoi edit-configAfter bootstrap completes:
- Shell changed to zsh (check:
echo $SHELL) - Homebrew installed (check:
brew --version) - Git configured (check:
git config --global user.email) - Dotfiles applied (check:
ls -la ~/) - CLI tools work (check:
bat --version,eza --version) - On macOS: GUI apps installed (check Applications folder)
After initial setup, keep your dotfiles updated:
# Pull latest changes and apply
chezmoi update
# Or manually
chezmoi git pull && chezmoi applyIf your dotfiles repo is private:
# 1. Generate SSH key
ssh-keygen -t ed25519 -C "your@email.com"
# 2. Add to GitHub
cat ~/.ssh/id_ed25519.pub
# Copy output and add to GitHub Settings → SSH Keys
# 3. Initialize with SSH URL
chezmoi init --apply git@github.com:yourusername/dotfiles.git# You'll be prompted for username and password/token
chezmoi init --apply https://github.com/yourusername/dotfiles.gitSave this for bootstrapping new machines:
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply yourusername/dotfilessh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply yourusername/dotfilesReplace yourusername/dotfiles with your repository path!
Everything from your Brewfile:
- Dev tools: git, git-lfs, gh, lazygit, node
- Modern CLI: bat, eza, fd, ripgrep, zoxide, tmux
- Utilities: curl, wget
- macOS only: Alacritty, VSCode, VLC, Fonts
All your dotfiles:
.zshrcwith aliases and configurations.config/directory contents- Git configuration
- Any other tracked files
- Check chezmoi status:
chezmoi doctor - View what would change:
chezmoi diff - See what scripts exist:
ls -R $(chezmoi source-path)/.chezmoiscripts/ - Check chezmoi docs: https://www.chezmoi.io/
Pro Tip: Test your bootstrap process in a virtual machine or Docker container before relying on it for a real machine setup!