TL;DR — Quick Summary

Chezmoi manages dotfiles across multiple machines securely. Templates for per-machine config, encrypted secrets, and automatic Git sync.

Chezmoi solves the dotfiles problem properly. Instead of fragile symlinks or manual copying, it manages your configs with templates, encrypted secrets, and Git sync — so your terminal setup follows you to every machine.

Installation

# macOS
brew install chezmoi

# Arch Linux
sudo pacman -S chezmoi

# Universal installer
sh -c "$(curl -fsLS get.chezmoi.io)"

# Verify
chezmoi --version

Quick Start

# Initialize (creates ~/.local/share/chezmoi/)
chezmoi init

# Add existing dotfiles
chezmoi add ~/.bashrc
chezmoi add ~/.gitconfig
chezmoi add ~/.config/starship.toml
chezmoi add ~/.ssh/config

# Edit a managed file
chezmoi edit ~/.bashrc

# Preview changes before applying
chezmoi diff

# Apply changes to home directory
chezmoi apply

# Push to Git
chezmoi cd  # enters source directory
git add . && git commit -m "Add dotfiles" && git push

Templates (Per-Machine Config)

Create ~/.local/share/chezmoi/dot_bashrc.tmpl:

# Common config
export EDITOR=helix
alias ll='ls -la'

{{ if eq .chezmoi.os "linux" -}}
# Linux-specific
alias open='xdg-open'
export PATH="$HOME/.local/bin:$PATH"
{{ end -}}

{{ if eq .chezmoi.os "darwin" -}}
# macOS-specific
export PATH="/opt/homebrew/bin:$PATH"
eval "$(/opt/homebrew/bin/brew shellenv)"
{{ end -}}

{{ if eq .chezmoi.hostname "work-laptop" -}}
# Work machine
export HTTP_PROXY=http://proxy.company.com:8080
{{ end -}}

Encrypted Secrets

# Set up age encryption
chezmoi age keygen -o ~/.config/chezmoi/key.txt

# Add to chezmoi config
chezmoi edit-config
# Add: [age] identity = "~/.config/chezmoi/key.txt"

# Add encrypted file
chezmoi add --encrypt ~/.ssh/id_ed25519

New Machine Setup

# One command to set up a new machine:
chezmoi init --apply your-github-username

# This clones your dotfiles repo and applies everything

Comparison

FeatureChezmoiStowYADMBare Git
MethodCopySymlinkGitGit
TemplatesYesNoJinjaNo
Encryptionage/gpg/1PNogpgNo
Multi-OSTemplatesManualAlt filesManual
Git built-inYesNoYesYes
One-line setupYesNoYesNo

Summary

  • Chezmoi manages dotfiles by copying with template support — not symlinks
  • Templates for per-machine, per-OS customization using Go template syntax
  • Encrypted secrets via age, gpg, 1Password, Bitwarden, and more
  • One-command setup on new machines: chezmoi init —apply username
  • Built-in Git integration for syncing across machines