chezmoi
Manage dotfiles across multiple machines
TLDR
Setup up chezmoi, creating a Git repository in ~/.local/share/chezmoi
Set up chezmoi from existing dotfiles of a Git repository
Start tracking one or more dotfiles
Update repository with local changes
Edit the source state of a tracked dotfile
See pending changes
Apply the changes
Pull changes from a remote repository and apply them
SYNOPSIS
chezmoi [global-options...] command [command-options] [arguments...]
PARAMETERS
-C, --config PATH
Configuration file path (default ~/.config/chezmoi/chezmoi.toml)
-D, --destination PATH
Destination directory (default $HOME)
-S, --source PATH
Source directory (default ~/.local/share/chezmoi)
--color WHEN
Color usage: auto, never, always (default auto)
-n, --dry-run
Simulate changes without applying
--exclude ATTR
Exclude attributes like executable, symlink
-f, --force
Allow potentially dangerous operations
-h, --help
Show help for command
--no-pager
Disable pager for output
-v, --verbose
Enable verbose logging
--version
Print version information
DESCRIPTION
Chezmoi is a robust command-line tool for managing personal configuration files, or dotfiles, across multiple machines and operating systems including Linux, macOS, Windows, and FreeBSD.
It stores dotfiles in a source directory (often a Git repository), using templates for dynamic content, and applies them idempotently to the destination directory (usually $HOME). This ensures consistent, reproducible setups.
Key features include:
• Templating with Go template syntax for machine-specific values (e.g., usernames, paths).
• Secrets management via age encryption or PGP keys.
• State tracking to detect changes in managed files.
• Commands like init, apply, add, diff for easy workflows.
• Git integration for versioning and sharing.
Chezmoi avoids common pitfalls like overwriting local changes unless forced, supports dry runs, and handles symlinks, executables, and permissions. It's secure by default, never storing plaintext secrets, making it ideal for developers maintaining configs across work, home, and servers.
CAVEATS
Not installed by default; requires manual installation via Go, package managers (e.g., apt, brew), or binaries. Source dir must be writable. Overwrites files on apply unless using --dry-run or state tracking.
COMMON COMMANDS
init [--apply] [repo-url]: Initialize from Git.
apply: Apply all changes.
add file: Add file to management.
update: Pull changes and apply.
diff: Show differences.
INSTALLATION
curl -sfL https://git.io/chezmoi | sh
Or go install github.com/twpayne/chezmoi@latest.
HISTORY
Developed by Tom Ryder starting 2015, first public release 2018. Actively maintained with v2.0+ in 2022 introducing better secrets and templates. Widely used in DevOps for reproducible setups, with 20k+ GitHub stars.


